diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..5daa7fad994533601e34c5790acbe779f0e54bee --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/target/ +/bin/ +/target-ide/ +/.project +/.classpath +/.settings + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..1e0b518b641a4e2e5496fc256e83fa9021f61372 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,36 @@ +include: + - project: osl/code/org.etsi.osl.main + ref: main + file: + - ci-templates/default.yml + - ci-templates/build.yml + rules: + - if: '$CI_COMMIT_REF_NAME == "main"' + + - project: osl/code/org.etsi.osl.main + ref: develop + file: + - ci-templates/default.yml + - ci-templates/build.yml + rules: + - if: '$CI_COMMIT_REF_NAME == "develop"' + + - project: osl/code/org.etsi.osl.main + ref: $CI_COMMIT_REF_NAME + file: + - ci-templates/default.yml + - ci-templates/build.yml + rules: + - if: '$CI_COMMIT_REF_PROTECTED && $CI_COMMIT_REF_NAME != "main" && $CI_COMMIT_REF_NAME != "develop"' + + - project: osl/code/org.etsi.osl.main + ref: develop + file: + - ci-templates/default.yml + - ci-templates/build_unprotected.yml + rules: + - if: '$CI_COMMIT_REF_NAME != "main" && $CI_COMMIT_REF_NAME != "develop" && !$CI_COMMIT_REF_PROTECTED' + +maven_build: + extends: .maven_build + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + 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. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index c6d3f3e064e817ed5a61113c7ade11a0d842ed12..c33123d8898fa2c28efb5dba77d1745b3928bf7e 100644 --- a/README.md +++ b/README.md @@ -1,92 +1,3 @@ # org.etsi.osl.sol005nbi.osm10 - - -## Getting started - -To make it easy for you to get started with GitLab, here's a list of recommended next steps. - -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! - -## Add your files - -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: - -``` -cd existing_repo -git remote add origin https://labs.etsi.org/rep/osl/code/org.etsi.osl.sol005nbi.osm10.git -git branch -M main -git push -uf origin main -``` - -## Integrate with your tools - -- [ ] [Set up project integrations](https://labs.etsi.org/rep/osl/code/org.etsi.osl.sol005nbi.osm10/-/settings/integrations) - -## Collaborate with your team - -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) - -## Test and Deploy - -Use the built-in continuous integration in GitLab. - -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) - -*** - -# Editing this README - -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template. - -## Suggestions for a good README -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Choose a self-explaining name for your project. - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. - -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. - -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. - -## License -For open source projects, say how it is licensed. - -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. +OSM TEN NBI implementation diff --git a/ci_settings.xml b/ci_settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..69ad06ed6c63795d191555afde6ea2d1da4e133d --- /dev/null +++ b/ci_settings.xml @@ -0,0 +1,16 @@ + + + + gitlab-maven + + + + Job-Token + ${CI_JOB_TOKEN} + + + + + + diff --git a/hackfest_multivdu_vnf.tar b/hackfest_multivdu_vnf.tar new file mode 100644 index 0000000000000000000000000000000000000000..ca7fd60c5af40c8f62255a5d1a37cc694154fd0d Binary files /dev/null and b/hackfest_multivdu_vnf.tar differ diff --git a/hackfest_multivdu_vnf.zip b/hackfest_multivdu_vnf.zip new file mode 100644 index 0000000000000000000000000000000000000000..ca7fd60c5af40c8f62255a5d1a37cc694154fd0d Binary files /dev/null and b/hackfest_multivdu_vnf.zip differ diff --git a/pathname b/pathname new file mode 100644 index 0000000000000000000000000000000000000000..ca7fd60c5af40c8f62255a5d1a37cc694154fd0d Binary files /dev/null and b/pathname differ diff --git a/pathname.tar b/pathname.tar new file mode 100644 index 0000000000000000000000000000000000000000..ca7fd60c5af40c8f62255a5d1a37cc694154fd0d Binary files /dev/null and b/pathname.tar differ diff --git a/pathname.tar.gz b/pathname.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..671f765eef81a4dc7b7a8b1a6ad2c141027ae6a3 Binary files /dev/null and b/pathname.tar.gz differ diff --git a/pom-generate-sources.xml b/pom-generate-sources.xml new file mode 100644 index 0000000000000000000000000000000000000000..3b3efb4c15732090ebf47bd23268b4ee915e059b --- /dev/null +++ b/pom-generate-sources.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + org.opendaylight.mdsal + binding-parent + 6.0.5 + + + org.etsi.osl.sol005nbi + org.etsi.osl.sol005nbi.osm10 jar + Descriptive Name Goes Here + 0.0.1-SNAPSHOT + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..b26a82fdf37c80b04d1fc1be183ae05317859e8a --- /dev/null +++ b/pom.xml @@ -0,0 +1,423 @@ + + 4.0.0 + + org.etsi.osl + org.etsi.osl.main + 1.0.0 + ../org.etsi.osl.main + + + jar + + org.etsi.osl.sol005nbi.osm10 + org.etsi.osl.sol005nbi.osm10 + + + openslice.io + http://openslice.io + + + 2021 + + + + + + Apache 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + A business-friendly OSS license + + + + + + opendaylight-release + opendaylight-release + https://nexus.opendaylight.org/content/repositories/opendaylight.release/ + + + opendaylight-snapshot + opendaylight-snapshot + https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ + + + + + + + gitlab-maven + https://labs.etsi.org/rep/api/v4/groups/260/-/packages/maven + + + opendaylight-release + opendaylight-release + https://nexus.opendaylight.org/content/repositories/opendaylight.release/ + + + opendaylight-snapshot + opendaylight-snapshot + https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ + + + + + gitlab-maven + ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven + + + gitlab-maven + ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven + + + + + + UTF-8 + ${project.build.directory}/generated-sources/mdsal-binding + UTF-8 + 2.0.0 + apache_v2 + 3.1.2 + 4.0.0-RC2 + + + + + + org.opendaylight.yangtools + yangtools-artifacts + 6.0.5 + pom + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot-version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + com.google.code.findbugs + annotations + 3.0.1 + + + org.opendaylight.yangtools + yang-common + 6.0.5 + + + + org.opendaylight.mdsal + yang-binding + 7.0.6 + + + + org.opendaylight.yangtools + yang-binding + 0.7.4-Lithium-SR4 + + + + + + + org.apache.httpcomponents.client5 + httpclient5 + 5.2.1 + + + + org.apache.httpcomponents.client5 + httpclient5-fluent + 5.2.1 + + + + + + org.etsi.osl + org.etsi.osl.sol005nbi.osm + ${org.etsi.osl.sol005nbi.osm.version} + + + org.springframework.boot + spring-boot-starter + + + org.springframework + spring-web + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + org.apache.commons + commons-lang3 + + + org.json + json + 20210307 + jar + + + org.apache.geronimo.specs + geronimo-jpa_2.0_spec + 1.1 + + + log4j + log4j + 1.2.17 + + + + + + + org.apache.commons + commons-compress + 1.20 + + + + + commons-io + commons-io + 2.8.0 + + + + + org.eclipse.jdt + org.eclipse.jdt.annotation + 2.2.600 + + + + + + + + + + + + src/main/resources + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 17 + 17 + + + + org.codehaus.mojo + license-maven-plugin + ${maven-license-plugin.version} + + false + ========================LICENSE_START================================= + =========================LICENSE_END================================== + src/main/java/io,src/main/java/OSMNBIClient,src/main/java/OSMUtil + + + + generate-license-headers + + update-file-header + + process-sources + + ${license.licenseName} + + + + + download-licenses + + download-licenses + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/OSM10NBIClient/NSActionRequestPayload.java b/src/main/java/OSM10NBIClient/NSActionRequestPayload.java new file mode 100644 index 0000000000000000000000000000000000000000..e9eb3237dcb8baed63dbaa3bea64e01d69812fd9 --- /dev/null +++ b/src/main/java/OSM10NBIClient/NSActionRequestPayload.java @@ -0,0 +1,158 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol007nbi.osm + * %% + * Copyright (C) 2019 openslice.io + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * =========================LICENSE_END================================== + */ + + +package OSM10NBIClient; + +import java.util.LinkedHashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + + +/** + * @author ichatzis + * + */ +public class NSActionRequestPayload +{ + + private String nsInstanceId; + private String member_vnf_index; // Needed for VNFD mapping NSD.constituent-vnfd.member-vnf-index. If missing a NSD is targeting. Example: "member_vnf_index": "1", + private String vdu_id; // Needed if target is a VDU. Maps VNFD.vdu-id + private String vdu_count_index; // Needed if the VDU has several replicas (count>1) + private String primitive; // Mandatory. Maps [NSD.ns-configuration or VNFD.vnf-configuration or VNFD.vdu.vdu-configuration].config-primitive.name. Example: "primitive": "touch" + private String param; + private String lcmOperationType; //"lcmOperationType": "action" + private String vnf_member_index; // TODO for backward compatibility. To remove in future + private String kdu_name; + private Integer timeout_ns_action; + private Map primitive_params = new LinkedHashMap<>(); + + public Map getPrimitive_params() { + return primitive_params; + } + + @JsonAnySetter + public void setPrimitive_params(Map primitive_params) { + this.primitive_params = primitive_params; + } + + public String getMember_vnf_index() { + return member_vnf_index; + } + + public void setMember_vnf_index(String member_vnf_index) { + this.member_vnf_index = member_vnf_index; + } + + public String getVdu_id() { + return vdu_id; + } + + public void setVdu_id(String vdu_id) { + this.vdu_id = vdu_id; + } + + public String getVdu_count_index() { + return vdu_count_index; + } + + public void setVdu_count_index(String vdu_count_index) { + this.vdu_count_index = vdu_count_index; + } + + public String getPrimitive() { + return primitive; + } + + public void setPrimitive(String primitive) { + this.primitive = primitive; + } + + public void setPrimitiveParams(String primitive_name, String primitive_value) { + } + + public String getParam() { + return param; + } + + public void setParam(String param) { + this.param = param; + } + + public String getLcmOperationType() { + return lcmOperationType; + } + + public void setLcmOperationType(String lcmOperationType) { + this.lcmOperationType = lcmOperationType; + } + + public String getNsInstanceId() { + return nsInstanceId; + } + + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + + public String getVnf_member_index() { + return vnf_member_index; + } + + public void setVnf_member_index(String vnf_member_index) { + this.vnf_member_index = vnf_member_index; + } + + public String getKdu_name() { + return kdu_name; + } + + public void setKdu_name(String kdu_name) { + this.kdu_name = kdu_name; + } + + public Integer getTimeout_ns_action() { + return timeout_ns_action; + } + + public void setTimeout_ns_action(Integer timeout_ns_action) { + this.timeout_ns_action = timeout_ns_action; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } +} + diff --git a/src/main/java/OSM10NBIClient/NSCreateInstanceRequestPayload.java b/src/main/java/OSM10NBIClient/NSCreateInstanceRequestPayload.java new file mode 100644 index 0000000000000000000000000000000000000000..e0154d07c8d9ab5ab15983be0290a8eea6c116db --- /dev/null +++ b/src/main/java/OSM10NBIClient/NSCreateInstanceRequestPayload.java @@ -0,0 +1,37 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol007nbi.osm + * %% + * Copyright (C) 2019 openslice.io + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * =========================LICENSE_END================================== + */ + + +package OSM10NBIClient; + +/** + * @author ctranoris + * + */ +public class NSCreateInstanceRequestPayload extends NSInstantiateInstanceRequestPayload +{ + private final String notificationType = "NsIdentifierCreationNotification"; + + public NSCreateInstanceRequestPayload() + { + super(); + } +} + diff --git a/src/main/java/OSM10NBIClient/NSInstantiateInstanceRequestPayload.java b/src/main/java/OSM10NBIClient/NSInstantiateInstanceRequestPayload.java new file mode 100644 index 0000000000000000000000000000000000000000..c6530b6a229d3ad93324a6bdc39b1ff60cc07ba7 --- /dev/null +++ b/src/main/java/OSM10NBIClient/NSInstantiateInstanceRequestPayload.java @@ -0,0 +1,209 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol005nbi.osm10 + * %% + * Copyright (C) 2019 openslice.io + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * =========================LICENSE_END================================== + */ + +package OSM10NBIClient; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class NSInstantiateInstanceRequestPayload +{ + private String nsName; + public String getNsName() { + return nsName; + } + + public void setNsName(String nsName) { + this.nsName = nsName; + } + + private String vimAccountId; + public String getVimAccountId() { + return vimAccountId; + } + + public void setVimAccountId(String vimAccountId) { + this.vimAccountId = vimAccountId; + } + + private Boolean wimAccountId; + public Boolean getWimAccountId() { + return wimAccountId; + } + + public void setWimAccountId(Boolean wimAccountId) { + this.wimAccountId = wimAccountId; + } + + + private String nsdId; + public String getNsdId() { + return nsdId; + } + + public void setNsdId(String nsdId) { + this.nsdId = nsdId; + } + + public class VnF + { + @JsonProperty("member-vnf-index") + private String memberVnFIndex; + public String getMemberVnFIndex() { + return memberVnFIndex; + } + public void setMemberVnFIndex(String memberVnFIndex) { + this.memberVnFIndex = memberVnFIndex; + } + @JsonProperty("vdu") + private List vdu = null; + + public List getVdu() { + return vdu; + } + public void setVdu(List vdu) { + this.vdu = vdu; + } + + @JsonProperty("vimAccountId") + private String vimAccount; + public String getVimAccount() { + return vimAccount; + } + public void setVimAccount(String vimAccount) { + this.vimAccount = vimAccount; + } + + public VnF() + { + + }; + } + + + public class Vdu + { + @JsonProperty("id") + private String id; + @JsonProperty("interface") + private ArrayList interfaceObj = null; + + public ArrayList getInterfaceObj() { + return interfaceObj; + } + public void setInterfaceObj(ArrayList interfaceObj) { + this.interfaceObj = interfaceObj; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + } + + public class NInterface + { + @JsonProperty("name") + private String name; + @JsonProperty("floating-ip-required") + private Boolean floating_ip_required; + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Boolean getFloating_ip_required() { + return floating_ip_required; + } + public void setFloating_ip_required(Boolean floating_ip_required) { + this.floating_ip_required = floating_ip_required; + } + } + + class Vld + { + @JsonProperty("name") + private String name; + @JsonProperty("vim-network-name") + private LinkedHashMap vimNetworkName = new LinkedHashMap<>(); + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public LinkedHashMap getVimNetworkName() { + return vimNetworkName; + } + public void setVimNetworkName(LinkedHashMap vimNetworkName) { + this.vimNetworkName = vimNetworkName; + } +// private String vimNetworkName; +// public String getVimNetworkName() { +// return vimNetworkName; +// } +// public void setVimNetworkName(String vimNetworkName) { +// this.vimNetworkName = vimNetworkName; +// } + } + private List vnf = new ArrayList<>(); + public List getVnf() { + return vnf; + } + + public void setVnf(List vnf) { + this.vnf = vnf; + } + + private List vld = new ArrayList<>(); + + public List getVld() { + return vld; + } + + public void setVld(List vld) { + this.vld = vld; + } + + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } + +} diff --git a/src/main/java/OSM10NBIClient/NSScaleRequestPayload.java b/src/main/java/OSM10NBIClient/NSScaleRequestPayload.java new file mode 100644 index 0000000000000000000000000000000000000000..ae3ce45869b27a3fd67fc93e326773824438595e --- /dev/null +++ b/src/main/java/OSM10NBIClient/NSScaleRequestPayload.java @@ -0,0 +1,158 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol007nbi.osm + * %% + * Copyright (C) 2019 openslice.io + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * =========================LICENSE_END================================== + */ + +package OSM10NBIClient; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * @author Ioannis Chatzis + * + */ +enum ScaleVnfType {SCALE_OUT, SCALE_IN}; + +public class NSScaleRequestPayload +{ + + private class ScaleVnfData + { + private class ScaleByStepData + { + private String scaling_group_descriptor; + private String member_vnf_index; + private String scaling_policy; + + public String getScaling_group_descriptor() { + return scaling_group_descriptor; + } + public void setScaling_group_descriptor(String scaling_group_descriptor) { + this.scaling_group_descriptor = scaling_group_descriptor; + } + public String getMember_vnf_index() { + return member_vnf_index; + } + public void setMember_vnf_index(String member_vnf_index) { + this.member_vnf_index = member_vnf_index; + } + public String getScaling_policy() { + return scaling_policy; + } + public void setScaling_policy(String scaling_policy) { + this.scaling_policy = scaling_policy; + } + } + + private ScaleVnfType scaleVnfType; + private String vnfInstanceId; + private ScaleByStepData scaleByStepData; + + public String getVnfInstanceId() { + return vnfInstanceId; + } + public ScaleByStepData getScaleByStepData() { + return scaleByStepData; + } + public void setScaleByStepData(ScaleByStepData scaleByStepData) { + this.scaleByStepData = scaleByStepData; + } + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + public ScaleVnfType getScaleVnfType() { + return scaleVnfType; + } + public void setScaleVnfType(ScaleVnfType scaleVnfType) { + this.scaleVnfType = scaleVnfType; + } + + } + + private String lcmOperationType; //"lcmOperationType": "scale" + private String nsInstanceId; + private String scaleType; + private String timeout_ns_scale; + private ScaleVnfData scaleVnfData; + private String scaleTime; + + public String getLcmOperationType() { + return lcmOperationType; + } + + public void setLcmOperationType(String lcmOperationType) { + this.lcmOperationType = lcmOperationType; + } + + public String getNsInstanceId() { + return nsInstanceId; + } + + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } + + public String getScaleType() { + return scaleType; + } + + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + public String getTimeout_ns_scale() { + return timeout_ns_scale; + } + + public void setTimeout_ns_scale(String timeout_ns_scale) { + this.timeout_ns_scale = timeout_ns_scale; + } + + public ScaleVnfData getScaleVnfData() { + return scaleVnfData; + } + + public void setScaleVnfData(ScaleVnfData scaleVnfData) { + this.scaleVnfData = scaleVnfData; + } + + public String getScaleTime() { + return scaleTime; + } + + public void setScaleTime(String scaleTime) { + this.scaleTime = scaleTime; + } +} + diff --git a/src/main/java/OSM10NBIClient/OSM10Client.java b/src/main/java/OSM10NBIClient/OSM10Client.java new file mode 100644 index 0000000000000000000000000000000000000000..cbc532bd1d10d1b79e727e86530c15390c0ef348 --- /dev/null +++ b/src/main/java/OSM10NBIClient/OSM10Client.java @@ -0,0 +1,1503 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol005nbi.osm10 + * %% + * Copyright (C) 2019 openslice.io + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * =========================LICENSE_END================================== + */ + +/** + * @author Ioannis Chatzis + * + * Describes a MANO provider that can be accessed via an API + * + */ + +package OSM10NBIClient; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLContext; + +import org.apache.commons.io.FileUtils; +import org.apache.hc.client5.http.classic.HttpClient; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.client5.http.cookie.Cookie; +import org.apache.hc.client5.http.cookie.StandardCookieSpec; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager; +import org.apache.hc.client5.http.io.HttpClientConnectionManager; +import org.apache.hc.client5.http.socket.ConnectionSocketFactory; +import org.apache.hc.client5.http.socket.PlainConnectionSocketFactory; +import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; +import org.apache.hc.client5.http.ssl.TrustSelfSignedStrategy; +import org.apache.hc.core5.http.config.Registry; +import org.apache.hc.core5.http.config.RegistryBuilder; +import org.apache.hc.core5.ssl.SSLContextBuilder; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.etsi.osl.sol005nbi.OSMClient; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +//import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.project.nsd.rev170228.project.nsd.catalog.Nsd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd; +//import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.project.vnfd.rev170228.project.vnfd.catalog.Vnfd; +//import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.Vnfd; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.HttpStatusCodeException; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; + +public class OSM10Client implements OSMClient { + + private static final Logger logger = LogManager.getLogger(OSM10Client.class); + + private HttpClient httpClient; + private String manoProjectId; + private String manoUsername; + private String manoPassword; + private HttpComponentsClientHttpRequestFactory requestFactory; + private String manoApiEndpoint = null; + private String manoAuthorizationBasicHeader = null; + private static Double manoAuthorizationTokenTimeout = 1.0; + private static String manoAuthorizationTokenID = null; + + public static void main(String args[]) { + logger.info("Make your calls here"); + } + + public OSM10Client(String apiEndpoint, String username, String password, String project_id) + throws HttpStatusCodeException { + this.setMANOPassword(password); + this.setMANOUsername(username); + this.setMANOProjectId(project_id); + this.setMANOApiEndpoint(apiEndpoint); + OSM10ClientInit(); + } + + public void closeConn() { +// try { +// this.httpClient.close(); +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } + try { + this.requestFactory.destroy(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void OSM10ClientInit() throws HttpStatusCodeException { + this.authenticateMANO(); + + // use the TrustSelfSignedStrategy to allow Self Signed Certificates + SSLContext sslContext; + try { + sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustSelfSignedStrategy()).build(); + // we can optionally disable hostname verification. + // if you don't want to further weaken the security, you don't have to include + // this. + HostnameVerifier allowAllHosts = new NoopHostnameVerifier(); + + // create an SSL Socket Factory to use the SSLContext with the trust self signed + // certificate strategy + // and allow all hosts verifier. + SSLConnectionSocketFactory sslConnectionFactory = new SSLConnectionSocketFactory(sslContext, allowAllHosts); + RegistryBuilder registryBuilder = RegistryBuilder.create(); + registryBuilder.register("https", sslConnectionFactory); + registryBuilder.register("http", PlainConnectionSocketFactory.INSTANCE); + Registry rgb = registryBuilder.build(); + + HttpClientConnectionManager ccm = new PoolingHttpClientConnectionManager( rgb ); + + httpClient = HttpClients + .custom() + .setConnectionManager(ccm) + .setDefaultRequestConfig(RequestConfig.custom().setCookieSpec(StandardCookieSpec.STRICT).build()) + .build(); + requestFactory = new HttpComponentsClientHttpRequestFactory(); + + requestFactory.setHttpClient(httpClient); + requestFactory.setConnectTimeout(2000); + } catch (KeyManagementException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (KeyStoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void getUsers() { + // Make an authenticated request for users + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + logger.debug(request.toString()); + ResponseEntity entity = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/admin/v1/users/", + HttpMethod.GET, request, String.class); + logger.debug(entity.getHeaders().toString()); + logger.debug(entity.getBody()); + logger.debug(entity.toString()); + } + + public ResponseEntity getOSMResponse(String reqURL) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + ResponseEntity entity = null; + try { + entity = restTemplate.exchange(this.getMANOApiEndpoint() + reqURL, HttpMethod.GET, request, String.class); + } catch (final HttpClientErrorException e) { + entity = ResponseEntity.status(e.getStatusCode()).body(e.getResponseBodyAsString()); + logger.debug(e.getStatusCode()); + logger.debug(e.getResponseBodyAsString()); + } + return entity; + } + + public ResponseEntity getOSMDeleteResponse(String reqURL) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + ResponseEntity entity = restTemplate.exchange(this.getMANOApiEndpoint() + reqURL, HttpMethod.DELETE, + request, String.class); + return entity; + } + + public void getVNFPackages() { + ResponseEntity response = this.getOSMResponse("/osm/vnfpkgm/v1/vnf_packages/"); + logger.debug(response.getHeaders().toString()); + String body_tmp = response.getBody(); + logger.debug(body_tmp); + JSONArray jsonArray = new JSONArray(body_tmp); + logger.debug(jsonArray); + } + + public Vnfd[] getVNFDs() { + ResponseEntity response = this.getOSMResponse("/osm/vnfpkgm/v1/vnf_packages/"); + ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); + + try { + Vnfd[] vnfd_array = (Vnfd[]) mapper.readValue(new YAMLFactory().createParser(response.getBody()), + Vnfd[].class); + return vnfd_array; + } catch (IllegalStateException | IOException e) { + logger.debug(response.getBody()); + logger.error(e.getMessage()); + e.printStackTrace(); + } + return null; + } + + public ResponseEntity getVNFDescriptorsList() { + logger.debug("Get VIMs Start"); + // Make an authenticated request for users + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + ResponseEntity get_vnfd_entities = null; + HttpEntity request = new HttpEntity(headers); + logger.debug(request.toString()); + try { + get_vnfd_entities = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/vnfpkgm/v1/vnf_packages/", + HttpMethod.GET, request, String.class); + } catch (RuntimeException e) { + if (get_vnfd_entities != null) { + if (get_vnfd_entities.getStatusCode().is5xxServerError() ) { + // handle SERVER_ERROR + + logger.error("Server ERROR:" + get_vnfd_entities.getStatusCode().toString()); + } else if (get_vnfd_entities.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + get_vnfd_entities.getStatusCode().toString()); + if (get_vnfd_entities.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + get_vnfd_entities.getBody()); + } else { + logger.error("Error! Null Response, " + e.getMessage()); + } + } + logger.debug(get_vnfd_entities.getHeaders().toString()); + logger.debug(get_vnfd_entities.getBody()); + logger.debug(get_vnfd_entities.toString()); + return get_vnfd_entities; + } + + public Nsd[] getNSDs() { + ResponseEntity response = this.getOSMResponse("/osm/nsd/v1/ns_descriptors"); + ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); + try { + Nsd[] nsd_array = (Nsd[]) mapper.readValue(new YAMLFactory().createParser(response.getBody()), Nsd[].class); + return nsd_array; + + } catch (IllegalStateException | IOException e) { + logger.error(e.getMessage()); + e.printStackTrace(); + } + return null; + } + + public ResponseEntity createVNFDPackage() { + // Create an instance of VNFD Package to fill. + // This is accomplished by posting to "/osm/vnfpkgm/v1/vnf_packages" + // The API returns the ID of the instance. + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + try { + return restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/vnfpkgm/v1/vnf_packages", HttpMethod.POST, + request, String.class); + + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + } + + public ResponseEntity createNSDPackage() { + // Create an instance of VNFD Package to fill. + // This is accomplished by posting to "/osm/vnfpkgm/v1/vnf_packages" + // The API returns the ID of the instance. + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + try { + return restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/nsd/v1/ns_descriptors", HttpMethod.POST, + request, String.class); + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + } + + private byte[] getByteArrayFromPackagePath(String package_path) throws Exception { + byte[] allBytes; + logger.info("Package path = " + package_path); + if (package_path.contains("http") || package_path.contains("localhost")) { + logger.info("Taking the http/localhost logic path"); + URL url = new URL(package_path); + URLConnection conn = url.openConnection(); + logger.info("Trying to open connection to URL"); + logger.info("URL Connection " + conn.toString()); + int contentLength = conn.getContentLength(); + logger.info("Content-Length:" + contentLength); + InputStream inputStream = url.openStream(); + + ByteArrayOutputStream tmpOut; + if (contentLength != -1) { + tmpOut = new ByteArrayOutputStream(contentLength); + } else { + tmpOut = new ByteArrayOutputStream(16384); // Pick some appropriate size + } + + byte[] buf = new byte[512]; + while (true) { + int len = inputStream.read(buf); + if (len == -1) { + break; + } + tmpOut.write(buf, 0, len); + } + tmpOut.close(); // No effect, but good to do anyway to keep the metaphor alive + allBytes = tmpOut.toByteArray(); + logger.info("Package allBytes size = " + allBytes.length); + logger.info("Package Filesize: " + contentLength + " bytes."); + inputStream.close(); + } else { + logger.info("Taking the local file path"); + InputStream inputStream = new FileInputStream(package_path); + long fileSize = new File(package_path).length(); + allBytes = new byte[(int) fileSize]; + inputStream.read(allBytes); + logger.info("Package Filesize: " + fileSize + " bytes."); + inputStream.close(); + } + return allBytes; + } + + public ResponseEntity uploadVNFDPackageContent(String vnfd_id, String package_path) throws IOException { + + byte[] allBytes; + try { + allBytes = this.getByteArrayFromPackagePath(package_path); + } catch (Exception e) { + logger.error("Error during VNFD Package file uploading! " + e.getStackTrace().toString()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .body("Error during VNFD Package file uploading! " + e.getMessage().toString()); + } + + return this.uploadVNFDPackageContent(vnfd_id, allBytes); + } + + @Override + public ResponseEntity uploadNSDPackageContent(String nsd_id, String package_path) throws IOException { + byte[] allBytes; + try { + allBytes = this.getByteArrayFromPackagePath(package_path); + } catch (Exception e) { + logger.error("Error during NSD Package file uploading! " + e.getStackTrace().toString()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .body("Error during NSD Package file uploading! " + e.getMessage().toString()); + } + return this.uploadNSDPackageContent(nsd_id, allBytes); + } + + public ResponseEntity uploadVNFDPackageContent(String vnfd_id, byte[] allBytes) throws IOException { + + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/gzip"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity send_zip_request = new HttpEntity<>(allBytes, headers); + try { + return restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/vnfpkgm/v1/vnf_packages/" + vnfd_id + "/package_content", + HttpMethod.PUT, send_zip_request, String.class); + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + } + + public ResponseEntity getVNFDPackageContent(String vnfd_id) throws IOException { + + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/zip"); + headers.add("Accept", "application/zip,application/yaml"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity send_zip_request = new HttpEntity(headers); + ResponseEntity get_vnfd_package_content = null; + try { + get_vnfd_package_content = restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/vnfpkgm/v1/vnf_packages/" + vnfd_id + "/vnfd", + HttpMethod.GET, send_zip_request, String.class); + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + FileUtils.writeStringToFile(new File("pathname"), get_vnfd_package_content.getBody()); + //.writeByteArrayToFile(new File("pathname"), get_vnfd_package_content.getBody().getBytes(Charset.defaultCharset())); + logger.debug(get_vnfd_package_content); + return get_vnfd_package_content; + } + + public ResponseEntity uploadNSDPackageContent(String nsd_id, byte[] allBytes) throws IOException { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/gzip"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity send_zip_request = new HttpEntity<>(allBytes, headers); + try { + return restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/nsd/v1/ns_descriptors/" + nsd_id + "/nsd_content", HttpMethod.PUT, + send_zip_request, String.class); + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + } + + // Creates an NS Instance based on vim_id and nsd_id. + public String createNSInstance(String ns_name, String vim_id, String nsd_id) { + // Response example + // {"notificationType": + // "NsIdentifierCreationNotification","nsName":"mynsi","vimAccountId":"8e0929c5-4cc2-4a78-887f-d3642336e18c","nsdId":"07191481-0213-4b24-a7dd-a2e98e76803c"} + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + // String body="{\"notificationType\": + // \"NsIdentifierCreationNotification\",\"nsName\":\"mynsi\",\"vimAccountId\":\""+vim_id+"\",\"nsdId\":\""+nsd_id+"\"}"; + String body = "{\"notificationType\": \"NsIdentifierCreationNotification\",\"nsName\":\"" + ns_name + + "\",\"vimAccountId\":\"" + vim_id + "\",\"nsdId\":\"" + nsd_id + "\"}"; + + HttpEntity create_ns_instance_request = new HttpEntity<>(body, headers); + ResponseEntity create_ns_instance_entity = null; + logger.debug(create_ns_instance_request); + try { + create_ns_instance_entity = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/nslcm/v1/ns_instances/", + HttpMethod.POST, create_ns_instance_request, String.class); + } catch (RuntimeException e) { + if (create_ns_instance_entity != null) { + if (create_ns_instance_entity.getStatusCode().is5xxServerError() ) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + create_ns_instance_entity.getStatusCode().toString()); + } else if (create_ns_instance_entity.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + create_ns_instance_entity.getStatusCode().toString()); + if (create_ns_instance_entity.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + create_ns_instance_entity.getBody()); + } else { + logger.error("Error! Null Response"); + } + return null; + } + + if (create_ns_instance_entity.getStatusCode() == HttpStatus.NO_CONTENT) { + logger.error("No Content Replied!"); + } + if (create_ns_instance_entity.getStatusCode() == HttpStatus.CREATED) { + logger.info("NS Instance Creation Succeded!"); + } + logger.debug(create_ns_instance_entity.getBody()); + JSONObject obj = new JSONObject(create_ns_instance_entity.getBody()); + String ns_instance_id = obj.getString("id"); + logger.info("The new NS Instance id is :" + ns_instance_id); + return ns_instance_id; + } + + public ResponseEntity createNSInstance2(String payload) { + // Response example + // {"notificationType": + // "NsIdentifierCreationNotification","nsName":"mynsi","vimAccountId":"8e0929c5-4cc2-4a78-887f-d3642336e18c","nsdId":"07191481-0213-4b24-a7dd-a2e98e76803c"} + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + // String body="{\"notificationType\": + // \"NsIdentifierCreationNotification\",\"nsName\":\"mynsi\",\"vimAccountId\":\""+vim_id+"\",\"nsdId\":\""+nsd_id+"\"}"; + String body = payload; + + HttpEntity create_ns_instance_request = new HttpEntity<>(body, headers); + ResponseEntity create_ns_instance_entity = null; + logger.debug(create_ns_instance_request); + try { + create_ns_instance_entity = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/nslcm/v1/ns_instances/", + HttpMethod.POST, create_ns_instance_request, String.class); + } catch (RuntimeException e) { + if (create_ns_instance_entity != null) { + if (create_ns_instance_entity.getStatusCode().is5xxServerError() ) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + create_ns_instance_entity.getStatusCode().toString()); + } else if (create_ns_instance_entity.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + create_ns_instance_entity.getStatusCode().toString()); + if (create_ns_instance_entity.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + create_ns_instance_entity.getBody()); + } else { + logger.error("Error! Null Response"); + } + } + + return create_ns_instance_entity; + } + + public ResponseEntity createNSInstance(String payload) { + // Response example + // {"notificationType": + // "NsIdentifierCreationNotification","nsName":"mynsi","vimAccountId":"8e0929c5-4cc2-4a78-887f-d3642336e18c","nsdId":"07191481-0213-4b24-a7dd-a2e98e76803c"} + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + // String body="{\"notificationType\": + // \"NsIdentifierCreationNotification\",\"nsName\":\"mynsi\",\"vimAccountId\":\""+vim_id+"\",\"nsdId\":\""+nsd_id+"\"}"; + String body = payload; + + HttpEntity create_ns_instance_request = new HttpEntity<>(body, headers); + logger.debug(create_ns_instance_request); + try { + return restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/nslcm/v1/ns_instances/", HttpMethod.POST, + create_ns_instance_request, String.class); + + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + } + + public JSONObject getNSInstanceInfo(String ns_instance_id) { + ResponseEntity ns_instance_id_info_response = this + .getOSMResponse("/osm/nslcm/v1/ns_instances/" + ns_instance_id); + logger.info("Status of Request: " + ns_instance_id_info_response.getStatusCode()); + if (!ns_instance_id_info_response.getStatusCode().is4xxClientError() + && !ns_instance_id_info_response.getStatusCode().is5xxServerError()) { + JSONObject ns_instance_info_obj = new JSONObject(ns_instance_id_info_response.getBody()); + return ns_instance_info_obj; + } else + return null; + } + + public JSONArray getAllNSInstanceInfo() { + ResponseEntity ns_instance_id_info_response = this + .getOSMResponse("/osm/nslcm/v1/ns_instances/"); + logger.info("Status of Request: " + ns_instance_id_info_response.getStatusCode()); + if (!ns_instance_id_info_response.getStatusCode().is4xxClientError() + && !ns_instance_id_info_response.getStatusCode().is5xxServerError()) { + JSONArray ns_instance_info_obj = new JSONArray(ns_instance_id_info_response.getBody()); + return ns_instance_info_obj; + } else + return null; + } + + public JSONObject getNSInstanceContentInfo(String ns_instance_id) { + ResponseEntity ns_instance_id_info_response = this + .getOSMResponse("/osm/nslcm/v1/ns_instances_content/" + ns_instance_id); + logger.info("Status of Request: " + ns_instance_id_info_response.getStatusCode()); + if (!ns_instance_id_info_response.getStatusCode().is4xxClientError() + && !ns_instance_id_info_response.getStatusCode().is5xxServerError()) { + JSONObject ns_instance_info_obj = new JSONObject(ns_instance_id_info_response.getBody()); + return ns_instance_info_obj; + } else + return null; + } + + public JSONObject getNSLCMDetails(String nsLcmOpOccId) { + ResponseEntity ns_instance_id_info_response = this + .getOSMResponse("/osm/nslcm/v1/ns_lcm_op_occs/" + nsLcmOpOccId); + logger.info("Status of Request: " + ns_instance_id_info_response.getStatusCode()); + if (!ns_instance_id_info_response.getStatusCode().is4xxClientError() + && !ns_instance_id_info_response.getStatusCode().is5xxServerError()) { + JSONObject ns_instance_info_obj = new JSONObject(ns_instance_id_info_response.getBody()); + return ns_instance_info_obj; + } else + return null; + } + + public ResponseEntity getNSLCMDetailsList() { + return this.getOSMResponse("/osm/nslcm/v1/ns_lcm_op_occs/"); + } + + public JSONObject getVNFInstanceInfo(String vnf_instance_id) { + ResponseEntity vnf_instance_id_info_response = this + .getOSMResponse("/osm/nslcm/v1/vnf_instances/" + vnf_instance_id); + JSONObject vnf_instance_info_obj = new JSONObject(vnf_instance_id_info_response.getBody()); + return vnf_instance_info_obj; + } + + public String getPDUDetails() { + ResponseEntity pdu_details_response = this.getOSMResponse("/pdu/v1/pdu_descriptors/"); + // JSONObject pdu_details_response_obj = new + // JSONObject(pdu_details_response.getBody()); + return pdu_details_response.toString(); + } + + public ResponseEntity getVNFInstanceInfoNew(String vnf_instance_id) { + ResponseEntity vnf_instance_id_info_response = this + .getOSMResponse("/osm/nslcm/v1/vnf_instances/" + vnf_instance_id); + // We should check if we got an error response. + // If we didn't we could do the JSON conversion in the application + // If we did get an error response we should decide on the behavior + try { + return vnf_instance_id_info_response; + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + } + + public ResponseEntity instantiateNSInstance(String ns_instance_id, String payload) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + logger.debug("/osm/nslcm/v1/ns_instances/" + ns_instance_id + "/instantiate"); + + String body = payload; + HttpEntity create_ns_instance_request = new HttpEntity<>(body, headers); + logger.debug(create_ns_instance_request); + try { + return restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/nslcm/v1/ns_instances/" + ns_instance_id + "/instantiate", + HttpMethod.POST, create_ns_instance_request, String.class); + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + } + + public ResponseEntity actionNSInstance(String ns_instance_id, String payload) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + logger.debug("/osm/nslcm/v1/ns_instances/" + ns_instance_id + "/action"); + + String body = payload; + HttpEntity create_ns_instance_request = new HttpEntity<>(body, headers); + logger.debug(create_ns_instance_request); + try { + return restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/nslcm/v1/ns_instances/" + ns_instance_id + "/action", + HttpMethod.POST, create_ns_instance_request, String.class); + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + } + + public String terminateNSInstance(String ns_instance_id) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + logger.debug("/osm/nslcm/v1/ns_instances/" + ns_instance_id + "/terminate"); + + ResponseEntity terminate_ns_instance_entity = null; + try { + terminate_ns_instance_entity = restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/nslcm/v1/ns_instances/" + ns_instance_id + "/terminate", + HttpMethod.POST, request, String.class); + } catch (RuntimeException e) { + if (terminate_ns_instance_entity != null) { + if (terminate_ns_instance_entity.getStatusCode().is5xxServerError()) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + terminate_ns_instance_entity.getStatusCode().toString()); + } else if (terminate_ns_instance_entity.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + terminate_ns_instance_entity.getStatusCode().toString()); + if (terminate_ns_instance_entity.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + terminate_ns_instance_entity.getBody()); + } else { + logger.error("Error! Null Response"); + } + return null; + } + + if (terminate_ns_instance_entity.getStatusCode() == HttpStatus.NO_CONTENT) { + logger.error("No Content Replied!"); + } + if (terminate_ns_instance_entity.getStatusCode() == HttpStatus.CREATED) { + logger.info("NS Termination Succeded!"); + } + logger.debug(terminate_ns_instance_entity.getBody()); + JSONObject obj = new JSONObject(terminate_ns_instance_entity.getBody()); + String ns_instanciation_id = obj.getString("id"); + logger.info("The NS termination id is :" + ns_instanciation_id); + return ns_instanciation_id; + + } + + public ResponseEntity terminateNSInstanceNew(String ns_instance_id) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + logger.debug("/osm/nslcm/v1/ns_instances/" + ns_instance_id + "/terminate"); + try { + return restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/nslcm/v1/ns_instances/" + ns_instance_id + "/terminate", + HttpMethod.POST, request, String.class); + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + } + + public ResponseEntity deleteNSInstance(String ns_instance_id) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + ResponseEntity delete_ns_instance_entity = null; + delete_ns_instance_entity = restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/nslcm/v1/ns_instances/" + ns_instance_id, HttpMethod.DELETE, request, + String.class); + if (delete_ns_instance_entity != null) { + if (delete_ns_instance_entity.getStatusCode().is5xxServerError()) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + delete_ns_instance_entity.getStatusCode().toString()); + } else if (delete_ns_instance_entity.getStatusCode().is4xxClientError() ) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + delete_ns_instance_entity.getStatusCode().toString()); + if (delete_ns_instance_entity.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + delete_ns_instance_entity.getBody()); + } else { + logger.error("Error! Null Response"); + } + + if (delete_ns_instance_entity.getStatusCode() == HttpStatus.NO_CONTENT) { + logger.error("No Content Replied!"); + } + if (delete_ns_instance_entity.getStatusCode() == HttpStatus.CREATED) { + logger.info("NS Deletion Succeded!"); + } + logger.debug("The NS instance deletion response is :" + delete_ns_instance_entity.getBody()); + return delete_ns_instance_entity; + } + + public ResponseEntity deleteNSInstanceNew(String ns_instance_id, boolean force) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + try { + if (force) { + return restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/nslcm/v1/ns_instances/" + ns_instance_id + "?FORCE=TRUE", + HttpMethod.DELETE, request, String.class); + } else { + return restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/nslcm/v1/ns_instances/" + ns_instance_id, + HttpMethod.DELETE, request, String.class); + } + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + } + + public Vnfd getVNFDbyID(String aVNFDid) { + logger.debug("/osm/vnfpkgm/v1/vnf_packages/" + aVNFDid); + ResponseEntity response = this.getOSMResponse("/osm/vnfpkgm/v1/vnf_packages/" + aVNFDid); + ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); + try { + Vnfd vnfd = (Vnfd) mapper.readValue(new YAMLFactory().createParser(response.getBody()), Vnfd.class); + return vnfd; + } catch (IllegalStateException | IOException e) { +// logger.error(e.getMessage() ); + e.printStackTrace(); + } + return null; + } + + public Nsd getNSDbyID(String aNSDid) { + logger.debug("/osm/nsd/v1/ns_descriptors/" + aNSDid); + ResponseEntity response = this.getOSMResponse("/osm/nsd/v1/ns_descriptors/" + aNSDid); + ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); + try { + Nsd nsd = (Nsd) mapper.readValue(new YAMLFactory().createParser(response.getBody()), Nsd.class); + logger.debug(nsd.toString()); + return nsd; + } catch (IllegalStateException | IOException e) { + logger.error(e.getMessage()); + e.printStackTrace(); + } + return null; + } + + public void deleteVNFDbyID(String aVNFDid) { + logger.debug("/osm/vnfpkgm/v1/vnf_packages/" + aVNFDid); + ResponseEntity response = this.getOSMDeleteResponse("/osm/vnfpkgm/v1/vnf_packages/" + aVNFDid); + ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); + try { + Vnfd vnfd = mapper.readValue(new YAMLFactory().createParser(response.getBody()), Vnfd.class); + } catch (IllegalStateException | IOException e) { + logger.error(e.getMessage()); + e.printStackTrace(); + } + } + + public ResponseEntity deleteVNFDPackage(String vnfd_id) throws HttpClientErrorException { + // Create an instance of VNFD Package to fill. + // This is accomplished by posting to "/osm/vnfpkgm/v1/vnf_packages" + // The API returns the ID of the instance. + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + ResponseEntity entity = null; + try { + entity = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/vnfpkgm/v1/vnf_packages/" + vnfd_id, + HttpMethod.DELETE, request, String.class); + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + logger.info("The delete NSD Package with id " + vnfd_id + " returned :" + entity.toString()); + + return entity; + } + + public void deleteNSDbyID(String aNSDid) { + logger.debug("/osm/nsd/v1/ns_descriptors/" + aNSDid); + ResponseEntity response = this.getOSMDeleteResponse("/osm/nsd/v1/ns_descriptors/" + aNSDid); + ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); + try { + Nsd nsd = mapper.readValue(new YAMLFactory().createParser(response.getBody()), Nsd.class); + } catch (IllegalStateException | IOException e) { + logger.error(e.getMessage()); + e.printStackTrace(); + } + } + + public ResponseEntity deleteNSDPackage(String nsd_id) { + // Create an instance of NSD Package to fill. + // This is accomplished by posting to "/osm/nsd/v1/ns_descriptors/" + // The API returns the ID of the instance. + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + ResponseEntity entity = null; + try { + entity = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/nsd/v1/ns_descriptors/" + nsd_id, + HttpMethod.DELETE, request, String.class); + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + logger.info("The delete NSD Package with id " + nsd_id + " returned :" + entity.toString()); + return entity; + } + + public void authenticateMANO() throws HttpStatusCodeException { + // use the TrustSelfSignedStrategy to allow Self Signed Certificates + SSLContext sslContext; + try { + sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustSelfSignedStrategy()).build(); + // we can optionally disable hostname verification. + // if you don't want to further weaken the security, you don't have to include + // this. + HostnameVerifier allowAllHosts = new NoopHostnameVerifier(); + + // create an SSL Socket Factory to use the SSLContext with the trust self signed + // certificate strategy + // and allow all hosts verifier. + SSLConnectionSocketFactory sslConnectionFactory = new SSLConnectionSocketFactory(sslContext, allowAllHosts); + RegistryBuilder registryBuilder = RegistryBuilder.create(); + registryBuilder.register("https", sslConnectionFactory); + registryBuilder.register("http", PlainConnectionSocketFactory.INSTANCE); + Registry rgb = registryBuilder.build(); + + HttpClientConnectionManager ccm = new PoolingHttpClientConnectionManager( rgb ); + + httpClient = HttpClients + .custom() + .setConnectionManager(ccm) + .setDefaultRequestConfig(RequestConfig.custom().setCookieSpec( StandardCookieSpec.STRICT ).build()) + .build(); + requestFactory = new HttpComponentsClientHttpRequestFactory(); + + requestFactory.setHttpClient(httpClient); + requestFactory.setConnectTimeout(2000); + } catch (KeyManagementException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (KeyStoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + String body = "{\"password\": \"" + this.getMANOPassword() + "\", \"username\": \"" + this.getMANOUsername() + + "\", \"project_id\": \"" + this.getMANOProjectId() + "\"}"; + HttpEntity request = new HttpEntity(body, headers); + logger.debug(request.toString()); + ResponseEntity entity = null; + entity = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/admin/v1/tokens/", HttpMethod.POST, request, + String.class); + logger.debug(entity.getHeaders().toString()); + logger.debug(entity.getBody()); + logger.debug(entity.toString()); + + JSONObject obj = new JSONObject(entity.getBody()); + this.setΜΑΝΟAuthorizationBasicHeader(obj.getString("id")); + OSM10Client.setManoAuthorizationTokenTimeout(obj.getDouble("expires")); + OSM10Client.setManoAuthorizationTokenID(obj.getString("id")); +// try { +// httpClient.close(); +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } + } + + private static String getManoAuthorizationTokenID() { + // TODO Auto-generated method stub + return OSM10Client.manoAuthorizationTokenID; + } + + private static void setManoAuthorizationTokenID(String tokenID) { + // TODO Auto-generated method stub + OSM10Client.manoAuthorizationTokenID = tokenID; + } + + public String getMANOApiEndpoint() { + return manoApiEndpoint; + } + + public void setMANOApiEndpoint(String apiEndpoint) { + this.manoApiEndpoint = apiEndpoint; + } + + /** + * @return the project_id + */ + public String getMANOProjectId() { + return manoProjectId; + } + + /** + * @param project_id the project_id to set + */ + public void setMANOProjectId(String project_id) { + this.manoProjectId = project_id; + } + + /** + * @return the username + */ + private String getMANOUsername() { + return manoUsername; + } + + /** + * @param username the username to set + */ + public void setMANOUsername(String username) { + this.manoUsername = username; + } + + /** + * @return the password + */ + private String getMANOPassword() { + return manoPassword; + } + + /** + * @param password the password to set + */ + public void setMANOPassword(String password) { + this.manoPassword = password; + } + + public String getMANOAuthorizationBasicHeader() { + return manoAuthorizationBasicHeader; + } + + public void setΜΑΝΟAuthorizationBasicHeader(String authorizationBasicHeader) { + this.manoAuthorizationBasicHeader = authorizationBasicHeader; + } + + /** + * @return the manoAuthorizationTokenTimeout + */ + public static Double getManoAuthorizationTokenTimeout() { + return manoAuthorizationTokenTimeout; + } + + /** + * @param manoAuthorizationTokenTimeout the manoAuthorizationTokenTimeout to set + */ + public static void setManoAuthorizationTokenTimeout(double manoAuthorizationTokenTimeout) { + OSM10Client.manoAuthorizationTokenTimeout = manoAuthorizationTokenTimeout; + } + + public String getNSLCMDetailsListByNSID(String nsid) { + ResponseEntity response = this.getOSMResponse("/osm/nslcm/v1/ns_lcm_op_occs/"); + String response_body = response.getBody(); + try { + JSONArray array = new JSONArray(response_body); + JSONArray array2 = new JSONArray(); + for (int i = 0; i < array.length(); ++i) { + JSONObject obj = array.getJSONObject(i); + String id = obj.getString("nsInstanceId"); + if (id.equals(nsid)) { + array2.put(obj); + } + + } + return array2.toString(); + } catch (JSONException e) { + return null; + } + } + + @Override + public ResponseEntity scaleNSInstance(String ns_instance_id, String payload) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + logger.debug("/osm/nslcm/v1/ns_instances/" + ns_instance_id + "/scale"); + + String body = payload; + HttpEntity create_ns_instance_request = new HttpEntity<>(body, headers); + logger.debug(create_ns_instance_request); + try { + return restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/nslcm/v1/ns_instances/" + ns_instance_id + "/scale", + HttpMethod.POST, create_ns_instance_request, String.class); + } catch (HttpStatusCodeException e) { + return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders()) + .body(e.getResponseBodyAsString()); + } + } + + + public void getNSDescriptors() { + ResponseEntity response = this.getOSMResponse("/osm/nsd/v1/ns_descriptors/"); + logger.debug(response.getHeaders().toString()); + logger.debug(response.getBody()); + } + + public ResponseEntity getNSDescriptorsList() { + logger.debug("Get NSDs Start"); + // Make an authenticated request for users + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + ResponseEntity get_nsd_entities = null; + HttpEntity request = new HttpEntity(headers); + logger.debug(request.toString()); + try { + get_nsd_entities = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/nsd/v1/ns_descriptors/", + HttpMethod.GET, request, String.class); + } catch (RuntimeException e) { + if (get_nsd_entities != null) { + if (get_nsd_entities.getStatusCode().is5xxServerError()) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + get_nsd_entities.getStatusCode().toString()); + } else if (get_nsd_entities.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + get_nsd_entities.getStatusCode().toString()); + if (get_nsd_entities.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + get_nsd_entities.getBody()); + } else { + logger.error("Error! Null Response, " + e.getMessage()); + } + } + logger.debug(get_nsd_entities.getHeaders().toString()); + logger.debug(get_nsd_entities.getBody()); + logger.debug(get_nsd_entities.toString()); + return get_nsd_entities; + } + + public ResponseEntity getNSInstancesList() { + logger.debug("Get NSInstances Start"); + // Make an authenticated request for users + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + ResponseEntity get_ns_instances = null; + HttpEntity request = new HttpEntity(headers); + logger.debug(request.toString()); + try { + get_ns_instances = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/nsd/v1/ns_descriptors/", + HttpMethod.GET, request, String.class); + } catch (RuntimeException e) { + if (get_ns_instances != null) { + if (get_ns_instances.getStatusCode().is5xxServerError()) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + get_ns_instances.getStatusCode().toString()); + } else if (get_ns_instances.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + get_ns_instances.getStatusCode().toString()); + if (get_ns_instances.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + get_ns_instances.getBody()); + } else { + logger.error("Error! Null Response, " + e.getMessage()); + } + } + logger.debug(get_ns_instances.getHeaders().toString()); + logger.debug(get_ns_instances.getBody()); + logger.debug(get_ns_instances.toString()); + return get_ns_instances; + } + + public ResponseEntity getVIMs() + { + logger.debug("Get VIMs Start"); + // Make an authenticated request for users + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + ResponseEntity get_vim_entities = null; + HttpEntity request = new HttpEntity(headers); + logger.debug(request.toString()); + try { + get_vim_entities = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/admin/v1/vim_accounts/", + HttpMethod.GET, request, String.class); + } catch (RuntimeException e) { + if (get_vim_entities != null) { + if (get_vim_entities.getStatusCode().is5xxServerError()) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + get_vim_entities.getStatusCode().toString()); + } else if (get_vim_entities.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + get_vim_entities.getStatusCode().toString()); + if (get_vim_entities.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + get_vim_entities.getBody()); + } else { + logger.error("Error! Null Response, " + e.getMessage()); + } + } + logger.debug(get_vim_entities.getHeaders().toString()); + logger.debug(get_vim_entities.getBody()); + logger.debug(get_vim_entities.toString()); + return get_vim_entities; + } + + public ResponseEntity createVim(String payload) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + String body = payload; + HttpEntity create_ns_instance_request = new HttpEntity<>(body, headers); + ResponseEntity create_vim_entity = null; + logger.debug(create_ns_instance_request); + try { + create_vim_entity = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/admin/v1/vim_accounts/", + HttpMethod.POST, create_ns_instance_request, String.class); + } catch (RuntimeException e) { + if (create_vim_entity != null) { + if (create_vim_entity.getStatusCode().is5xxServerError()) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + create_vim_entity.getStatusCode().toString()); + } else if (create_vim_entity.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + create_vim_entity.getStatusCode().toString()); + if (create_vim_entity.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + create_vim_entity.getBody()); + } else { + logger.error("Error! Null Response, " + e.getMessage()); + } + } + + return create_vim_entity; + } + + public ResponseEntity editVim(String vim_id, String payload) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + String body = payload; + HttpEntity create_ns_instance_request = new HttpEntity<>(body, headers); + ResponseEntity edit_vim_entity = null; + logger.debug(create_ns_instance_request); + try { + edit_vim_entity = restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/admin/v1/vim_accounts/" + vim_id + "/", HttpMethod.PATCH, + create_ns_instance_request, String.class); + } catch (RuntimeException e) { + if (edit_vim_entity != null) { + if (edit_vim_entity.getStatusCode().is5xxServerError()) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + edit_vim_entity.getStatusCode().toString()); + } else if (edit_vim_entity.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + edit_vim_entity.getStatusCode().toString()); + if (edit_vim_entity.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + edit_vim_entity.getBody()); + } else { + logger.error("Error! Null Response, " + e.getMessage()); + } + } + + return edit_vim_entity; + } +// public ResponseEntity deleteVim() +// {} + + public ResponseEntity createUser(String payload) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + String body = payload; + HttpEntity create_user_request = new HttpEntity<>(body, headers); + ResponseEntity create_user_entity = null; + logger.debug(create_user_request); + try { + create_user_entity = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/admin/v1/users/", + HttpMethod.POST, create_user_request, String.class); + } catch (RuntimeException e) { + if (create_user_entity != null) { + if (create_user_entity.getStatusCode().is5xxServerError()) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + create_user_entity.getStatusCode().toString()); + } else if (create_user_entity.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + create_user_entity.getStatusCode().toString()); + if (create_user_entity.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + create_user_entity.getBody()); + } else { + logger.error("Error! Null Response, " + e.getMessage()); + } + } + + return create_user_entity; + } + + public ResponseEntity editUser(String user_id, String payload) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + String body = payload; + // String + // body="{\"password\":\"123\",\"add_project_role_mappings\":[{\"project\":\"admin\",\"role\":\"project_admin\"},{\"project\":\"test\",\"role\":\"project_admin\"}]}"; + // String body="{\"password\":\"1234\"}"; + // {"username":"ioannis","password":"123","projects":["admin","test"],"project_role_mappings":[{"project":"admin","role":"system_admin"},{"project":"test","role":"system_admin"}],"add_project_role_mappings":[{"project":"admin","role":"system_admin"},{"project":"test","role":"system_admin"}],"remove_project_role_mappings":[{"project":"admin","role":"system_admin"},{"project":"test","role":"system_admin"}]} + + HttpEntity edit_user_request = new HttpEntity<>(body, headers); + ResponseEntity edit_user_entity = null; + logger.debug(edit_user_request); + try { + edit_user_entity = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/admin/v1/users/" + user_id + "/", + HttpMethod.PATCH, edit_user_request, String.class); + } catch (RuntimeException e) { + if (edit_user_entity != null) { + if (edit_user_entity.getStatusCode().is5xxServerError()) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + edit_user_entity.getStatusCode().toString()); + } else if (edit_user_entity.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + edit_user_entity.getStatusCode().toString()); + if (edit_user_entity.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + edit_user_entity.getBody()); + } else { + logger.error("Error! Null Response, " + e.getMessage()); + } + } + return edit_user_entity; + } + + public ResponseEntity createProject(String payload) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + String body = payload; + HttpEntity create_project_request = new HttpEntity<>(body, headers); + ResponseEntity create_project_entity = null; + logger.debug(create_project_request); + try { + create_project_entity = restTemplate.exchange(this.getMANOApiEndpoint() + "/osm/admin/v1/projects/", + HttpMethod.POST, create_project_request, String.class); + } catch (RuntimeException e) { + if (create_project_entity != null) { + if (create_project_entity.getStatusCode().is5xxServerError()) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + create_project_entity.getStatusCode().toString()); + } else if (create_project_entity.getStatusCode().is4xxClientError()) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + create_project_entity.getStatusCode().toString()); + if (create_project_entity.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + create_project_entity.getBody()); + } else { + logger.error("Error! Null Response, " + e.getMessage()); + } + } + + return create_project_entity; + } + + public ResponseEntity editProject(String project_id, String payload) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + String body = payload; + HttpEntity edit_project_request = new HttpEntity<>(body, headers); + ResponseEntity edit_user_entity = null; + logger.debug(edit_project_request); + try { + edit_user_entity = restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/admin/v1/projects/" + project_id + "/", HttpMethod.PATCH, + edit_project_request, String.class); + } catch (RuntimeException e) { + if (edit_user_entity != null) { + if (edit_user_entity.getStatusCode().is5xxServerError()) { + // handle SERVER_ERROR + logger.error("Server ERROR:" + edit_user_entity.getStatusCode().toString()); + } else if (edit_user_entity.getStatusCode().is4xxClientError() ) { + // handle CLIENT_ERROR + logger.error("Client ERROR:" + edit_user_entity.getStatusCode().toString()); + if (edit_user_entity.getStatusCode() == HttpStatus.NOT_FOUND) { + logger.error("Unknown Response Status"); + } + } + logger.error("Error! " + edit_user_entity.getBody()); + } else { + logger.error("Error! Null Response, " + e.getMessage()); + } + } + return edit_user_entity; + } + + public ResponseEntity getProjectDeleteResponse(String project_id) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + ResponseEntity entity = restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/admin/v1/projects/" + project_id + "/", HttpMethod.DELETE, request, + String.class); + return entity; + } + + public ResponseEntity getUserDeleteResponse(String user_id) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + ResponseEntity entity = restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/admin/v1/users/" + user_id + "/", HttpMethod.DELETE, request, + String.class); + return entity; + } + + public ResponseEntity getVIMDeleteResponse(String vim_id) { + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add("content-type", "application/json"); + headers.add("accept", "application/json"); + headers.add("Authorization", "Bearer " + this.getMANOAuthorizationBasicHeader()); + HttpEntity request = new HttpEntity(headers); + ResponseEntity entity = restTemplate.exchange( + this.getMANOApiEndpoint() + "/osm/admin/v1/vim_accounts/" + vim_id + "/", HttpMethod.DELETE, request, + String.class); + return entity; + } + +// public ResponseEntity deleteUser() +// {} +// + +// public ResponseEntity createProject() +// {} +// public ResponseEntity editProject() +// {} +// public ResponseEntity deleteProject() +// {} +// + +// +// public ResponseEntity createRole() +// {} +// public ResponseEntity editRole() +// {} +// public ResponseEntity deleteRole() +// {} + +} diff --git a/src/main/java/OSM10NBIClient/OSM10NBIClientT.java b/src/main/java/OSM10NBIClient/OSM10NBIClientT.java new file mode 100644 index 0000000000000000000000000000000000000000..07e1c947da68aed653193caf242b3ff4e152658e --- /dev/null +++ b/src/main/java/OSM10NBIClient/OSM10NBIClientT.java @@ -0,0 +1,488 @@ +package OSM10NBIClient; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.jdt.annotation.Nullable; +import org.etsi.osl.sol005nbi.OSMClient; +import org.json.JSONArray; +import org.json.JSONObject; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.project.nsd.rev170228.nsd.constituent.vnfd.ConstituentVnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.project.nsd.rev170228.nsd.constituent.vnfd.ConstituentVnfdKey; +//import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.project.nsd.rev170228.project.nsd.catalog.Nsd; +//import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.project.vnfd.rev170228.project.vnfd.catalog.Vnfd; +//import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.project.nsd.rev170228.project.nsd.catalog.Nsd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd; +//import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.project.nsd.rev170228.project.nsd.catalog.NsdBuilder; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.NsdBuilder; +//import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.project.vnfd.rev170228.project.vnfd.catalog.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.Vnfd; +//import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.vnfr.rev170228.project.vnfr.catalog.vnfr.VnfdBuilder; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.VnfdBuilder; + +import org.springframework.http.ResponseEntity; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import OSM10NBIClient.NSInstantiateInstanceRequestPayload.NInterface; +import OSM10NBIClient.NSInstantiateInstanceRequestPayload.Vdu; +import OSM10Util.OSM10VNFReq.OSM10VNFRequirements; + +public class OSM10NBIClientT { + + public static void main(String args[]) { + OSM10Client OSM10Client = new OSM10Client("https://10.10.10.41:9999","admin","admin","admin"); + String body="{\"username\":\"ioannis\",\"domain_name\":\"test\",\"password\":\"123\",\"projects\":[\"admin\",\"test\"],\"project_role_mappings\":[{\"project\":\"admin\",\"role\":\"system_admin\"},{\"project\":\"test\",\"role\":\"system_admin\"}]}"; + //{"username":"ioannis","domain_name":"test","password":"123","projects":["admin","test"],"project_role_mappings":[{"project":"admin","role":"system_admin"},{"project":"test","role":"system_admin"}]} + //String body = payload; + +// //PROJECT CREATE +// ProjectCreateRequestPayload payloadCreateProject = new ProjectCreateRequestPayload(); +// payloadCreateProject.setName("test5"); +// payloadCreateProject.setAdmin(true); +// payloadCreateProject.setDomain_name("test"); +// OSM10Client.createProject(payloadCreateProject.toJSON()); + +// //PROJECT EDIT +// ProjectEditRequestPayload payloadEditProject = new ProjectEditRequestPayload(); +// payloadEditProject.setAdmin(false); +// payloadEditProject.setName("test6"); +// OSM10Client.editProject("521ff1e9-f980-475f-9266-c428de028f37",payloadEditProject.toJSON()); + + //OSM10Client.getProjectDeleteResponse("b127ae37-b39a-4c3e-abe8-8ffb2b4bd61f"); + +// //USER CREATE +// UserCreateRequestPayload payloadNewUser = new UserCreateRequestPayload(); +// payloadNewUser.setUsername("ioannis3"); +// payloadNewUser.setDomain_name("test"); +// payloadNewUser.setPassword("123"); +// List tmpProjects = new ArrayList(); +// tmpProjects.add("admin"); +// tmpProjects.add("test"); +// payloadNewUser.setProjects(tmpProjects); +// ProjectRoleMapping prm = new ProjectRoleMapping("admin","system_admin"); +// List prml = new ArrayList(); +// prml.add(prm); +// prm = new ProjectRoleMapping("test","system_admin"); +// prml.add(prm); +// payloadNewUser.setProject_role_mappings(prml); +// //System.out.println("Payload "+payloadNewUser.toJSON()); +// OSM10Client.createUser(payloadNewUser.toJSON()); + + //USER EDIT +// UserEditRequestPayload payloadEditUser = new UserEditRequestPayload(); +// //payloadEditUser.setUsername("ioannis3"); +// payloadEditUser.setPassword("123"); +// List tmpProjectsEdit = new ArrayList(); +// tmpProjectsEdit.add("admin"); +// tmpProjectsEdit.add("test"); +// tmpProjectsEdit.add("test2"); +// payloadEditUser.setProjects(tmpProjectsEdit); +// List prmlEdit = new ArrayList(); +// prmlEdit.add(new ProjectRoleMapping("admin","system_admin")); +// prmlEdit.add(new ProjectRoleMapping("test","project_user")); +// prmlEdit.add(new ProjectRoleMapping("test2","project_user")); +// payloadEditUser.setProject_role_mappings(prmlEdit); +//// List prmlEdit2 = new ArrayList(); +//// prmlEdit2.add(new ProjectRoleMapping("test2","system_admin")); +//// payloadEditUser.setAdd_project_role_mappings(prmlEdit2); +//// System.out.println("Payload "+payloadEditUser.toJSON()); +// OSM10Client.editUser("1914ec5b-af9a-4f32-8806-b6aa29b302f2",payloadEditUser.toJSON()); + + +// //VIM CREATE +// VIMCreateRequestPayload payloadNewVIM = new VIMCreateRequestPayload(); +// payloadNewVIM.setName("CloudVille3"); +// payloadNewVIM.setVim_type("openstack"); +// payloadNewVIM.setVim_url("http://10.80.0.11:5000/v3/"); +// payloadNewVIM.setVim_tenant_name("OSMFIVE"); +// payloadNewVIM.setVim_user("osmfivevim"); +// payloadNewVIM.setVim_password("osmfivevim5g#"); +// OSM10Client.createVim(payloadNewVIM.toJSON()); + ResponseEntity vims_list_entity = OSM10Client.getVIMs(); + if (vims_list_entity == null || vims_list_entity.getStatusCode().is4xxClientError() + || vims_list_entity.getStatusCode().is5xxServerError()) { + System.out.println("VIMs List Get Request failed. Status Code:" + vims_list_entity.getStatusCode().toString() + + ", Payload:" + vims_list_entity.getBody().toString()); + } else { + // NS action starts + System.out.println("Got VIM list "+vims_list_entity.getBody()); + } + + try { + ResponseEntity vnfd_package_content = OSM10Client.getVNFDPackageContent("5261da07-b38f-4115-863c-1465893bd8d3"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + JSONArray tmp = OSM10Client.getAllNSInstanceInfo(); + System.out.println(tmp.toString()); +// +// //VIM EDIT +// VIMEditRequestPayload payloadEditVIM = new VIMEditRequestPayload(); +// payloadEditVIM.setName("CloudVille"); +// payloadEditVIM.setVim_url("http://10.80.0.11:5000/v3/"); +// payloadEditVIM.setVim_type("Openstack"); +// payloadEditVIM.setDatacenter("datacenter"); +// payloadEditVIM.setDescription("description"); +// payloadEditVIM.setVim_password("osmfivevim5g#"); +// payloadEditVIM.setVim_user("OSMFIVE"); +// String vim_id = "6d080e3b-cbd1-4c4e-a114-9c556c285eb4"; +// OSM10Client.editVim(vim_id,payloadEditVIM.toJSON()); + + +// System.out.println("************************"); +// System.out.println("Getting Users"); +// System.out.println("************************"); +// OSM10Client.getUsers(); +// System.out.println("************************"); +// System.out.println("Getting VNFPackages"); +// System.out.println("************************"); +// OSM10Client.getVNFPackages(); +// System.out.println("************************"); +// System.out.println("Getting VNFDs"); +// System.out.println("************************"); +// Vnfd[] vnfds = OSM10Client.getVNFDs(); +// if(vnfds!=null) +// { +// for (Vnfd v : vnfds) { +// System.out.println("=== LIST VNFDs POJO object response: " + v.toString()); +// System.out.println("=== LIST VNFDs POJO object id: " + v.getId() + ", Name: " + v.getProductName()); +// Vnfd tmp_vnfd = OSM10Client.getVNFDbyID(v.getId()); +// System.out.println("=== LIST VNFDs POJO object id: " + tmp_vnfd.getId() + ", Name: " + tmp_vnfd.getProductName()); +// } +// } +// System.out.println("************************"); +// System.out.println("Getting NSDescriptors"); +// System.out.println("************************"); +// OSM10Client.getNSDescriptors(); +// System.out.println("************************"); +// System.out.println("Getting NSDs"); +// System.out.println("************************"); +// Nsd[] nsds = OSM10Client.getNSDs(); +// for (Nsd v : nsds) { +// System.out.println("=== LIST NSDs POJO object response: " + v.toString()); +// System.out.println("=== LIST NSDs POJO object id: " + v.getId() + ", Name: " + v.getName()); +// Nsd tmp_nsd = OSM10Client.getNSDbyID(v.getId()); +// System.out.println("=== LIST NSDs POJO object id: " + tmp_nsd.getId() + ", Name: " + tmp_nsd.getName()); +// } +// System.out.println("Working Directory = " +System.getProperty("user.dir")); +// +// //Create VNFD +// System.out.println("************************"); +// System.out.println("Creating VNF Instance"); +// System.out.println("************************"); +// ResponseEntity response = null; +// response = OSM10Client.createVNFDPackage(); +// if (response == null || response.getStatusCode().is4xxClientError() || response.getStatusCode().is5xxServerError()) { +// System.out.println("VNFD Package Creation failed."); +// return; +// } +// else +// { +// JSONObject obj = new JSONObject(response.getBody()); +// String vnfd_id = obj.getString("id"); +// System.out.println(response.getStatusCode()+" replied. The new VNFD Package id is :" + vnfd_id); +// System.out.println("Uploading VNF Package from URL"); +// System.out.println("************************"); +// String vnfd_package_path = "http://localhost/osm/hackfest_multivdu_vnf.tar.gz"; +// try { +// response = OSM10Client.uploadVNFDPackageContent(vnfd_id, vnfd_package_path); +// if (response == null || response.getStatusCode().is4xxClientError() +// || response.getStatusCode().is5xxServerError()) { +// System.out.println("Upload of VNFD Package Content failed. Deleting VNFD Package."+response.getBody()); +// // Delete the package from the OSM +// OSM10Client.deleteVNFDPackage(vnfd_id); +// return; +// } +// else +// { +// System.out.println("VNFD Package uploaded successfully"); +// } +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } + + +//// System.out.println("************************"); +//// System.out.println("Uploading VNF Zip from local file"); +//// System.out.println("************************"); +//// String vnfd_zip_path = "./src/main/resources/temp/cirros_vnf.tar.gz"; +//// try +//// { +//// OSM10Client.uploadVNFDZip(vnfd_id, vnfd_zip_path); +//// } +//// catch(IOException e) +//// { +//// System.out.println(e.getMessage()); +//// return; +//// } + +// System.out.println("Uploading NSD Package from URL"); +// System.out.println("************************"); +// String nsd_package_path = "http://localhost/osm/hackfest_multivdu_ns.tar.gz"; +// String nsd_id = null; +// response = OSM10Client.createNSDPackage(); +// if (response == null || response.getStatusCode().is4xxClientError() || response.getStatusCode().is5xxServerError()) { +// System.out.println("NSD Package Creation failed."); +// return; +// } +// else +// { +// JSONObject obj = new JSONObject(response.getBody()); +// nsd_id = obj.getString("id"); +// System.out.println(response.getStatusCode()+" replied. The new NSD Package id is :" + nsd_id); +// System.out.println("Uploading NS Package from URL"); +// System.out.println("************************"); +// try { +// response = OSM10Client.uploadNSDPackageContent(nsd_id, nsd_package_path); +// if (response == null || response.getStatusCode().is4xxClientError() +// || response.getStatusCode().is5xxServerError()) { +// System.out.println("Upload of NSD Package Content failed. Deleting NSD Package."); +// // Delete the package from the OSM +// OSM10Client.deleteVNFDPackage(nsd_id); +// return; +// } +// else +// { +// System.out.println("NSD Package uploaded successfully"); +// } +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } +// +// //Create NSD +// System.out.println("************************"); +// System.out.println("Uploading NSD Zip from local file"); +// System.out.println("************************"); +// System.out.println("************************"); +// System.out.println("Creating NSD Instance"); +// System.out.println("************************"); +// String nsd_id = OSM10Client.createNSDPackage(); +// // TODO Handle failure acquiring a vnfd_id +// System.out.println("************************"); +// System.out.println("Uploading NSD Zip"); +// System.out.println("************************"); +// String nsd_zip_path = "C:/EP/OSMDEVOPS/OSMvFIVE_NSDs/cirros_2vnf_ns_b.tar.gz"; +// OSM10Client.uploadNSDZip(nsd_id, nsd_zip_path); +// +// //Create NS Instance +// System.out.println("************************"); +// System.out.println("Creating NS Instance"); +// System.out.println("************************"); +// String vim_id="033797cd-cc1e-4727-b9a6-9f7024c92c6e"; +// String ns_instance_id = OSM10Client.createNSInstance("test",vim_id, nsd_id); +// if(ns_instance_id!=null) +// { +// OSM10Client.InstantiateNSInstance(ns_instance_id); +// } +// pressAnyKeyToContinue(); +// if(ns_instance_id!=null) +// { +// OSM10Client.deleteNSInstance(ns_instance_id); +// } + + } +// @Nullable Map constituentVnfds = OSM10Client.getNSDbyID(nsd_id).getConstituentVnfd(); +// NSCreateInstanceRequestPayload nscreateinstancerequestpayload = new NSCreateInstanceRequestPayload(); +// nscreateinstancerequestpayload.setNsName("test"); +// nscreateinstancerequestpayload.setVimAccountId("4efd8bf4-5292-4634-87b7-7b3d49108b36"); +// nscreateinstancerequestpayload.setWimAccountId(false); +// // Here we need to get the ExperimentOnBoardDescriptor based on the Experiment. +// // An Experiment might have multiple OnBoardDescriptors if it is OnBoarded to multiple OSM MANOs. +// // We temporarily select the first (and most probably the only one). +// // Otherwise the user needs to define the OSM MANO where the Experiment is OnBoarded in order to instantiate. +// nscreateinstancerequestpayload.setNsdId(nsd_id); +// Integer count = 0; +// for(ConstituentVnfd constituenVnfd : constituentVnfds.values()) +// { +// OSM10NBIClient.NSInstantiateInstanceRequestPayload.VnF vnf_tmp = nscreateinstancerequestpayload.new VnF(); +// count=count+1; +// vnf_tmp.setMemberVnFIndex(count.toString()); +// if(count!=2) +// vnf_tmp.setVimAccount("4efd8bf4-5292-4634-87b7-7b3d49108b36"); +// else +// { +// vnf_tmp.setVimAccount("8571aa95-4c17-4d87-a865-c98126dd0241"); +// OSM10NBIClient.NSInstantiateInstanceRequestPayload.Vdu vdu_tmp = nscreateinstancerequestpayload.new Vdu(); +// vdu_tmp.setId("cirros_vnfd-VM"); +// OSM10NBIClient.NSInstantiateInstanceRequestPayload.NInterface interface_tmp = nscreateinstancerequestpayload.new NInterface(); +// interface_tmp.setName("eth0"); +// interface_tmp.setFloating_ip_required(true); +// vdu_tmp.setInterfaceObj(new ArrayList()); +// vdu_tmp.getInterfaceObj().add(interface_tmp); +// vnf_tmp.setVdu(new ArrayList()); +// vnf_tmp.getVdu().add(vdu_tmp); +// } +// nscreateinstancerequestpayload.getVnf().add(vnf_tmp); +// } +// { +// OSM10NBIClient.NSInstantiateInstanceRequestPayload.Vld vld_tmp = nscreateinstancerequestpayload.new Vld(); +// vld_tmp.setName("cirros_3vnf_nsd_vld1"); +// +//// IpProfileParamsBuilder ipprofileparamsbuilder = new IpProfileParamsBuilder(); +//// ipprofileparamsbuilder.setIpVersion(IpVersion.Ipv4); +//// ipprofileparamsbuilder.setSubnetAddress(new IpPrefix(new Ipv4Prefix("192.168.100.0/24"))); +//// ipprofileparamsbuilder.setGatewayAddress(new IpAddress(new Ipv4Address("0.0.0.0"))); +//// List dnsserverlist = new ArrayList(); +//// DnsServerBuilder dnsserverbuilder = new DnsServerBuilder(); +//// dnsserverbuilder.setAddress(new IpAddress(new Ipv4Address("8.8.8.8"))); +//// dnsserverlist.add(dnsserverbuilder.build()); +//// ipprofileparamsbuilder.setDnsServer(dnsserverlist); +//// IpProfileParams ipprofileparams_tmp = ipprofileparamsbuilder.build(); +//// vld_tmp.setIpProfile(ipprofileparams_tmp); +// +// //vld_tmp.setVimNetworkName("OSMFIVE_selfservice01"); +// LinkedHashMap tmp=new LinkedHashMap<>(); +// tmp.put("4efd8bf4-5292-4634-87b7-7b3d49108b36","OSMFIVE_selfservice01"); +// tmp.put("8571aa95-4c17-4d87-a865-c98126dd0241","OSMFIVE_selfservice01"); +// vld_tmp.setVimNetworkName(tmp); +// nscreateinstancerequestpayload.getVld().add(vld_tmp); +// +// OSM10NBIClient.NSInstantiateInstanceRequestPayload.Vld vld_tmp2 = nscreateinstancerequestpayload.new Vld(); +// vld_tmp2.setName("cirros_3vnf_nsd_vld2"); +// //vld_tmp2.setVimNetworkName("OSM_mgmt_net"); +// LinkedHashMap tmp2=new LinkedHashMap<>(); +// tmp2.put("4efd8bf4-5292-4634-87b7-7b3d49108b36","OSM_mgmt_net"); +// tmp2.put("8571aa95-4c17-4d87-a865-c98126dd0241","OSM_mgmt_net"); +// vld_tmp2.setVimNetworkName(tmp2); +// nscreateinstancerequestpayload.getVld().add(vld_tmp2); +// } +// //String tmptmp="{\"nsName\":\"test\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\",\"nsdId\":\"65a644b1-6079-44ba-a227-34577079928b\",\"vnf\":[{\"member-vnf-index\":\"1\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\"},{\"member-vnf-index\":\"2\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\"},{\"member-vnf-index\":\"3\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\"}],\"vld\":[{\"name\":\"cirros_3vnf_nsd_vld1\",\"vim-network-name\":\"OSMFIVE_selfservice01\"},{\"name\":\"cirros_3vnf_nsd_vld2\",\"vim-network-name\":\"OSM_mgmt_net\"}]}"; +// // Get Experiment ID and VIM ID and create NS Instance. +// System.out.println("NS Instance creation payload : " + nscreateinstancerequestpayload.toJSON()); +// ResponseEntity ns_instance_creation_entity = OSM10Client.createNSInstance(nscreateinstancerequestpayload.toJSON()); +// //String test_payload="{\"nsName\":\"test\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\",\"nsdId\":\""+nsd_id+"\",\"vnf\":[{\"member-vnf-index\":\"1\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\", \"vdu\":[ {\"id\": \"mgmtVM\", \"interface\": [{\"name\": \"mgmtVM-eth0\", \"floating-ip-required\": true }]} ]},{\"member-vnf-index\":\"2\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\"}],\"vld\": [ {\"name\": \"mgmtnet\", \"vim-network-name\": \"OSMFIVE_selfservice01\"}]}"; +// //String test_payload="{\"nsName\":\"test\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\",\"nsdId\":\""+nsd_id+"\",\"vnf\":[{\"member-vnf-index\":\"1\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\"},{\"member-vnf-index\":\"2\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\"}],\"vld\": [ {\"name\": \"mgmtnet\", \"vim-network-name\": \"OSMFIVE_selfservice01\"}]}"; +// //System.out.println("NS Instance creation payload : " + test_payload); +// //ResponseEntity ns_instance_creation_entity = OSM10Client.createNSInstance(test_payload); +// // The NS Instance ID is set +// +// // NS instance creation +// if (ns_instance_creation_entity == null || ns_instance_creation_entity.getStatusCode().is4xxClientError() +// || ns_instance_creation_entity.getStatusCode().is5xxServerError()) { +// // NS instance creation failed +// System.out.println("NS Instance creation failed with response: "+ ns_instance_creation_entity.getBody().toString()); +// } else { +// // String nsr_id = +// JSONObject ns_instance_creation_entity_json_obj = new JSONObject(ns_instance_creation_entity.getBody()); +// System.out.println("NS creation succeded with "+ns_instance_creation_entity.getBody()); +// String nsd_instance_id = ns_instance_creation_entity_json_obj.getString("id"); +// // Instantiate NS Instance +// NSInstantiateInstanceRequestPayload nsrequestpayload = new NSInstantiateInstanceRequestPayload(); +// nsrequestpayload.setNsName("test"); +// nsrequestpayload.setVimAccountId("4efd8bf4-5292-4634-87b7-7b3d49108b36"); +// nsrequestpayload.setWimAccountId(false); +// nsrequestpayload.setNsdId(nsd_id); +// count = 0; +// for(ConstituentVnfd constituenVnfd : constituentVnfds.values()) +// { +// OSM10NBIClient.NSInstantiateInstanceRequestPayload.VnF vnf_tmp = nsrequestpayload.new VnF(); +// count=count+1; +// vnf_tmp.setMemberVnFIndex(count.toString()); +// if(count!=2) +// vnf_tmp.setVimAccount("4efd8bf4-5292-4634-87b7-7b3d49108b36"); +// else +// { +// vnf_tmp.setVimAccount("8571aa95-4c17-4d87-a865-c98126dd0241"); +// OSM10NBIClient.NSInstantiateInstanceRequestPayload.Vdu vdu_tmp = nscreateinstancerequestpayload.new Vdu(); +// vdu_tmp.setId("cirros_vnfd-VM"); +// OSM10NBIClient.NSInstantiateInstanceRequestPayload.NInterface interface_tmp = nscreateinstancerequestpayload.new NInterface(); +// interface_tmp.setName("eth0"); +// interface_tmp.setFloating_ip_required(true); +// vdu_tmp.setInterfaceObj(new ArrayList()); +// vdu_tmp.getInterfaceObj().add(interface_tmp); +// vnf_tmp.setVdu(new ArrayList()); +// vnf_tmp.getVdu().add(vdu_tmp); +// } +// nsrequestpayload.getVnf().add(vnf_tmp); +// } +// { +// OSM10NBIClient.NSInstantiateInstanceRequestPayload.Vld vld_tmp = nsrequestpayload.new Vld(); +// vld_tmp.setName("cirros_3vnf_nsd_vld1"); +// +//// IpProfileParamsBuilder ipprofileparamsbuilder = new IpProfileParamsBuilder(); +//// ipprofileparamsbuilder.setIpVersion(IpVersion.Ipv4); +//// ipprofileparamsbuilder.setSubnetAddress(new IpPrefix(new Ipv4Prefix("192.168.100.0/24"))); +//// ipprofileparamsbuilder.setGatewayAddress(new IpAddress(new Ipv4Address("0.0.0.0"))); +//// List dnsserverlist = new ArrayList(); +//// DnsServerBuilder dnsserverbuilder = new DnsServerBuilder(); +//// dnsserverbuilder.setAddress(new IpAddress(new Ipv4Address("8.8.8.8"))); +//// dnsserverlist.add(dnsserverbuilder.build()); +//// ipprofileparamsbuilder.setDnsServer(dnsserverlist); +//// IpProfileParams ipprofileparams_tmp = ipprofileparamsbuilder.build(); +//// vld_tmp.setIpProfile(ipprofileparams_tmp); +// +// //vld_tmp.setVimNetworkName("OSMFIVE_selfservice01"); +// LinkedHashMap tmp=new LinkedHashMap<>(); +// tmp.put("4efd8bf4-5292-4634-87b7-7b3d49108b36","OSMFIVE_selfservice01"); +// tmp.put("8571aa95-4c17-4d87-a865-c98126dd0241","OSMFIVE_selfservice01"); +// vld_tmp.setVimNetworkName(tmp); +// nsrequestpayload.getVld().add(vld_tmp); +// +// OSM10NBIClient.NSInstantiateInstanceRequestPayload.Vld vld_tmp2 = nsrequestpayload.new Vld(); +// vld_tmp2.setName("cirros_3vnf_nsd_vld2"); +// //vld_tmp2.setVimNetworkName("OSM_mgmt_net"); +// LinkedHashMap tmp2=new LinkedHashMap<>(); +// tmp2.put("4efd8bf4-5292-4634-87b7-7b3d49108b36","OSM_mgmt_net"); +// tmp2.put("8571aa95-4c17-4d87-a865-c98126dd0241","OSM_mgmt_net"); +// vld_tmp2.setVimNetworkName(tmp2); +// nsrequestpayload.getVld().add(vld_tmp2); +// } +// System.out.println("NS Instantiation payload : " + nsrequestpayload.toJSON()); +// +// +// //String test_payload={"nsName":"test","vimAccountId":"4efd8bf4-5292-4634-87b7-7b3d49108b36","nsdId":"acc18b58-1b82-40e8-8c35-2bfcc8293cdf","vnf":[{"member-vnf-index":"1","vimAccountId":"4efd8bf4-5292-4634-87b7-7b3d49108b36", vdu:[ {id: mgmtVM, interface: [{name: "mgmtVM-eth0", floating-ip-required: true }]} ], vld: [ {name: mgmtnet, vim-network-name: "OSMFIVE_selfservice01"} ]},{"member-vnf-index":"2","vimAccountId":"4efd8bf4-5292-4634-87b7-7b3d49108b36"}]}; +// //String test_payload="{\"nsName\":\"test\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\",\"nsdId\":\"acc18b58-1b82-40e8-8c35-2bfcc8293cdf\",\"vnf\":[{\"member-vnf-index\":\"1\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\", vdu:[ {id: mgmtVM, interface: [{name: \"mgmtVM-eth0\", floating-ip-required: true }]} ], vld: [ {name: mgmtnet, vim-network-name: \"OSMFIVE_selfservice01\"} ]},{\"member-vnf-index\":\"2\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\"}]}"; +// //String test_payload="{\"nsName\":\"test\",\"vimAccountId\":\"4efd8bf4-5292-4634-87b7-7b3d49108b36\",\"nsdId\":\""+nsd_id+"\"}"; +// //ResponseEntity instantiate_ns_instance_entity = OSM10Client.instantiateNSInstance(nsd_instance_id, test_payload); +// // Here we need the feedback +// ResponseEntity instantiate_ns_instance_entity = OSM10Client.instantiateNSInstance(nsd_instance_id, nsrequestpayload.toJSON()); +// if (instantiate_ns_instance_entity == null || instantiate_ns_instance_entity.getStatusCode().is4xxClientError() || instantiate_ns_instance_entity.getStatusCode().is5xxServerError()) { +// System.out.println("NS Instantiation failed. Status Code:" +// + instantiate_ns_instance_entity.getStatusCode().toString() + ", Payload:" +// + ns_instance_creation_entity.getBody().toString()); +// } else { +// // NS Instantiation starts +// System.out.println("NS Instantiation of NS with id" + nsd_instance_id + " started."); +// // Save the changes to DeploymentDescriptor +// } +// } +// +// +// } +//// public OSM10Client() { +//// // Properties file path. +//// String filePath = "osm4.properties.xml"; +//// Properties prop = new Properties(); +//// try (InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(filePath)) { +//// +//// // Loading the properties. +//// prop.loadFromXML(inputStream); +//// +//// // Getting properties +//// this.manoApiEndpoint = prop.getProperty("osm4.apiEndPoint"); +//// this.manoUsername = prop.getProperty("osm4.username"); +//// this.manoPassword = prop.getProperty("osm4.password"); +//// this.manoProjectId = prop.getProperty("osm4.projectId"); +//// } catch (IOException ex) { +//// logger.error("Problem while reading properties file !"); +//// ex.printStackTrace(); +//// } +//// +//// OSM10ClientInit(); +//// } +// + +} diff --git a/src/main/java/OSM10NBIClient/ProjectCreateRequestPayload.java b/src/main/java/OSM10NBIClient/ProjectCreateRequestPayload.java new file mode 100644 index 0000000000000000000000000000000000000000..3b231cc3f143c007140382a08f7bfc4b9268c795 --- /dev/null +++ b/src/main/java/OSM10NBIClient/ProjectCreateRequestPayload.java @@ -0,0 +1,65 @@ +package OSM10NBIClient; + +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +//{"name":"test4","quotas":{"vnfds":1,"nsds":0,"slice_templates":0,"pduds":0,"ns_instances":0,"slice_instances":0,"vim_accounts":0,"wim_accounts":0,"sdn_controllers":0,"k8sclusters":0,"k8srepos":0,"osmrepos":1}} +public class ProjectCreateRequestPayload { + + String name; + Boolean admin; + String domain_name; + List> quotas; + + public List> getQuotas() { + return quotas; + } + + public void setQuotas(List> quotas) { + this.quotas = quotas; + } + + public Boolean getAdmin() { + return admin; + } + + public void setAdmin(Boolean admin) { + this.admin = admin; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDomain_name() { + return domain_name; + } + + public void setDomain_name(String domain_name) { + this.domain_name = domain_name; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } + + +} diff --git a/src/main/java/OSM10NBIClient/ProjectEditRequestPayload.java b/src/main/java/OSM10NBIClient/ProjectEditRequestPayload.java new file mode 100644 index 0000000000000000000000000000000000000000..f87b4ea4698db3eba75ff36be03633902c6297da --- /dev/null +++ b/src/main/java/OSM10NBIClient/ProjectEditRequestPayload.java @@ -0,0 +1,54 @@ +package OSM10NBIClient; + +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class ProjectEditRequestPayload { + + String name; + Boolean admin; + List> quotas; + + public List> getQuotas() { + return quotas; + } + + public void setQuotas(List> quotas) { + this.quotas = quotas; + } + + public Boolean getAdmin() { + return admin; + } + + public void setAdmin(Boolean admin) { + this.admin = admin; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } + +} diff --git a/src/main/java/OSM10NBIClient/ProjectRoleMapping.java b/src/main/java/OSM10NBIClient/ProjectRoleMapping.java new file mode 100644 index 0000000000000000000000000000000000000000..a652e2f50b96cd819a9c794ea0e38d7f0d610ad3 --- /dev/null +++ b/src/main/java/OSM10NBIClient/ProjectRoleMapping.java @@ -0,0 +1,24 @@ +package OSM10NBIClient; + +public class ProjectRoleMapping { + private String project; + private String role; + + public ProjectRoleMapping(String project, String role) { + // TODO Auto-generated constructor stub + this.project=project; + this.role=role; + } + public String getProject() { + return project; + } + public void setProject(String project) { + this.project = project; + } + public String getRole() { + return role; + } + public void setRole(String role) { + this.role = role; + } +} diff --git a/src/main/java/OSM10NBIClient/UserCreateRequestPayload.java b/src/main/java/OSM10NBIClient/UserCreateRequestPayload.java new file mode 100644 index 0000000000000000000000000000000000000000..910a96b454dea29b54eb0368470ade0feaaf0e70 --- /dev/null +++ b/src/main/java/OSM10NBIClient/UserCreateRequestPayload.java @@ -0,0 +1,73 @@ +package OSM10NBIClient; + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class UserCreateRequestPayload { + + private String username; + private String domain_name; + private String password; + private List projects; + + public List getProjects() { + return projects; + } + + public void setProjects(List projects) { + this.projects = projects; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public List getProject_role_mappings() { + return project_role_mappings; + } + + public void setProject_role_mappings(List project_role_mappings) { + this.project_role_mappings = project_role_mappings; + } + + private List project_role_mappings = new ArrayList(); + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getDomain_name() { + return domain_name; + } + + public void setDomain_name(String domain_name) { + this.domain_name = domain_name; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } + +} diff --git a/src/main/java/OSM10NBIClient/UserEditRequestPayload.java b/src/main/java/OSM10NBIClient/UserEditRequestPayload.java new file mode 100644 index 0000000000000000000000000000000000000000..4f1d924cdad3942a8fbf5c401a607ccceaa61d90 --- /dev/null +++ b/src/main/java/OSM10NBIClient/UserEditRequestPayload.java @@ -0,0 +1,83 @@ +package OSM10NBIClient; + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +//{"username":"ioannis","password":"123","projects":["admin","test"],"project_role_mappings":[{"project":"admin","role":"system_admin"},{"project":"test","role":"system_admin"}],"add_project_role_mappings":[{"project":"admin","role":"system_admin"},{"project":"test","role":"system_admin"}],"remove_project_role_mappings":[{"project":"admin","role":"system_admin"},{"project":"test","role":"system_admin"}]} +public class UserEditRequestPayload { + + private String username; + private String password; + private List projects; + private List project_role_mappings = null; + private List add_project_role_mappings = null; + private List remove_project_role_mappings = null; + + + public List getAdd_project_role_mappings() { + return add_project_role_mappings; + } + + public void setAdd_project_role_mappings(List add_project_role_mappings) { + this.add_project_role_mappings = add_project_role_mappings; + } + + public List getRemove_project_role_mappings() { + return remove_project_role_mappings; + } + + public void setRemove_project_role_mappings(List remove_project_role_mappings) { + this.remove_project_role_mappings = remove_project_role_mappings; + } + + public List getProjects() { + return projects; + } + + public void setProjects(List projects) { + this.projects = projects; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public List getProject_role_mappings() { + return project_role_mappings; + } + + public void setProject_role_mappings(List project_role_mappings) { + this.project_role_mappings = project_role_mappings; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } + +} diff --git a/src/main/java/OSM10NBIClient/VIMCreateRequestPayload.java b/src/main/java/OSM10NBIClient/VIMCreateRequestPayload.java new file mode 100644 index 0000000000000000000000000000000000000000..c53855f37da240642cc26d53764e31745907da73 --- /dev/null +++ b/src/main/java/OSM10NBIClient/VIMCreateRequestPayload.java @@ -0,0 +1,109 @@ +package OSM10NBIClient; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class VIMCreateRequestPayload { + private String schema_version; + private String schema_type; + private String name; + private String description; + private String vim; + private String datacenter; + private String vim_type; + private String vim_url; + private String vim_tenant_name; + private String vim_user; + private String vim_password; + private String config; + + public String getSchema_version() { + return schema_version; + } + public void setSchema_version(String schema_version) { + this.schema_version = schema_version; + } + public String getSchema_type() { + return schema_type; + } + public void setSchema_type(String schema_type) { + this.schema_type = schema_type; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getVim() { + return vim; + } + public void setVim(String vim) { + this.vim = vim; + } + public String getDatacenter() { + return datacenter; + } + public void setDatacenter(String datacenter) { + this.datacenter = datacenter; + } + public String getVim_type() { + return vim_type; + } + public void setVim_type(String vim_type) { + this.vim_type = vim_type; + } + public String getVim_url() { + return vim_url; + } + public void setVim_url(String vim_url) { + this.vim_url = vim_url; + } + public String getVim_tenant_name() { + return vim_tenant_name; + } + public void setVim_tenant_name(String vim_tenant_name) { + this.vim_tenant_name = vim_tenant_name; + } + public String getVim_user() { + return vim_user; + } + public void setVim_user(String vim_user) { + this.vim_user = vim_user; + } + public String getVim_password() { + return vim_password; + } + public void setVim_password(String vim_password) { + this.vim_password = vim_password; + } + public String getConfig() { + return config; + } + public void setConfig(String config) { + this.config = config; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } + + +} diff --git a/src/main/java/OSM10NBIClient/VIMEditRequestPayload.java b/src/main/java/OSM10NBIClient/VIMEditRequestPayload.java new file mode 100644 index 0000000000000000000000000000000000000000..0c9d6d935664369116110117c64ca1f253189f07 --- /dev/null +++ b/src/main/java/OSM10NBIClient/VIMEditRequestPayload.java @@ -0,0 +1,94 @@ +package OSM10NBIClient; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class VIMEditRequestPayload { + private String name; + private String description; + private String vim; + private String datacenter; + private String vim_type; + private String vim_url; + private String vim_tenant_name; + private String vim_user; + private String vim_password; + private String config; + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getVim() { + return vim; + } + public void setVim(String vim) { + this.vim = vim; + } + public String getDatacenter() { + return datacenter; + } + public void setDatacenter(String datacenter) { + this.datacenter = datacenter; + } + public String getVim_type() { + return vim_type; + } + public void setVim_type(String vim_type) { + this.vim_type = vim_type; + } + public String getVim_url() { + return vim_url; + } + public void setVim_url(String vim_url) { + this.vim_url = vim_url; + } + public String getVim_tenant_name() { + return vim_tenant_name; + } + public void setVim_tenant_name(String vim_tenant_name) { + this.vim_tenant_name = vim_tenant_name; + } + public String getVim_user() { + return vim_user; + } + public void setVim_user(String vim_user) { + this.vim_user = vim_user; + } + public String getVim_password() { + return vim_password; + } + public void setVim_password(String vim_password) { + this.vim_password = vim_password; + } + public String getConfig() { + return config; + } + public void setConfig(String config) { + this.config = config; + } + + public String toJSON() + { + String jsonInString=null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return jsonInString; + } + +} diff --git a/src/main/java/OSM10NBIClient/testjsonparse.java b/src/main/java/OSM10NBIClient/testjsonparse.java new file mode 100644 index 0000000000000000000000000000000000000000..9aa307337c6cd2669b42b7096fd8e070552d325e --- /dev/null +++ b/src/main/java/OSM10NBIClient/testjsonparse.java @@ -0,0 +1,3977 @@ +package OSM10NBIClient; +//package OSM10NBIClient; +// +//import org.json.JSONArray; +//import org.json.JSONException; +//import org.json.JSONObject; +// +//public class testjsonparse { +// +// public static void main(String args[]) { +// +// String previous = "[\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"instantiate\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613927630.8796887,\r\n" +// + " \"modified\": 1613927845.185602,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"lcmOperationType\": \"instantiate\",\r\n" +// + " \"nsdId\": \"f9e6028b-c244-4125-9143-4f218da44ea9\",\r\n" +// + " \"nsName\": \"test\",\r\n" +// + " \"vimAccountId\": \"e06d0d06-bef6-4678-ac17-77d848d422ba\",\r\n" +// + " \"vnf\": [\r\n" +// + " {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"vimAccountId\": \"e06d0d06-bef6-4678-ac17-77d848d422ba\"\r\n" +// + " }\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"startTime\": 1613927630.8796134,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/2efab51b-1357-4c32-a1d8-597b2875fddc\"\r\n" +// + " },\r\n" +// + " \"_id\": \"2efab51b-1357-4c32-a1d8-597b2875fddc\",\r\n" +// + " \"id\": \"2efab51b-1357-4c32-a1d8-597b2875fddc\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613927845.1855993\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"24b235ed-01d3-46ba-83c6-fb0c1513b9bd\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613927932.8781176,\r\n" +// + " \"modified\": 1613927964.094152,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613927933.033377\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613927932.8780527,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/78ad3102-eb9e-41f9-bcc0-ef8c6c3d7c56\"\r\n" +// + " },\r\n" +// + " \"_id\": \"78ad3102-eb9e-41f9-bcc0-ef8c6c3d7c56\",\r\n" +// + " \"id\": \"78ad3102-eb9e-41f9-bcc0-ef8c6c3d7c56\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613927964.0941498\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"24b235ed-01d3-46ba-83c6-fb0c1513b9bd\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613927992.9959521,\r\n" +// + " \"modified\": 1613928045.7064617,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613927993.138056\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613927992.9959092,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/d6c18899-4857-4dd8-81b8-f44078660f16\"\r\n" +// + " },\r\n" +// + " \"_id\": \"d6c18899-4857-4dd8-81b8-f44078660f16\",\r\n" +// + " \"id\": \"d6c18899-4857-4dd8-81b8-f44078660f16\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613928045.7064598\r\n" +// + " }\r\n" +// + "]"; +// String current = "[\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"instantiate\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613927630.8796887,\r\n" +// + " \"modified\": 1613927845.185602,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"lcmOperationType\": \"instantiate\",\r\n" +// + " \"nsdId\": \"f9e6028b-c244-4125-9143-4f218da44ea9\",\r\n" +// + " \"nsName\": \"test\",\r\n" +// + " \"vimAccountId\": \"e06d0d06-bef6-4678-ac17-77d848d422ba\",\r\n" +// + " \"vnf\": [\r\n" +// + " {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"vimAccountId\": \"e06d0d06-bef6-4678-ac17-77d848d422ba\"\r\n" +// + " }\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"startTime\": 1613927630.8796134,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/2efab51b-1357-4c32-a1d8-597b2875fddc\"\r\n" +// + " },\r\n" +// + " \"_id\": \"2efab51b-1357-4c32-a1d8-597b2875fddc\",\r\n" +// + " \"id\": \"2efab51b-1357-4c32-a1d8-597b2875fddc\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613927845.1855993\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"24b235ed-01d3-46ba-83c6-fb0c1513b9bd\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613927932.8781176,\r\n" +// + " \"modified\": 1613927964.094152,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613927933.033377\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613927932.8780527,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/78ad3102-eb9e-41f9-bcc0-ef8c6c3d7c56\"\r\n" +// + " },\r\n" +// + " \"_id\": \"78ad3102-eb9e-41f9-bcc0-ef8c6c3d7c56\",\r\n" +// + " \"id\": \"78ad3102-eb9e-41f9-bcc0-ef8c6c3d7c56\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613927964.0941498\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"24b235ed-01d3-46ba-83c6-fb0c1513b9bd\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613927992.9959521,\r\n" +// + " \"modified\": 1613928045.7064617,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613927993.138056\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613927992.9959092,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/d6c18899-4857-4dd8-81b8-f44078660f16\"\r\n" +// + " },\r\n" +// + " \"_id\": \"d6c18899-4857-4dd8-81b8-f44078660f16\",\r\n" +// + " \"id\": \"d6c18899-4857-4dd8-81b8-f44078660f16\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613928045.7064598\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"24b235ed-01d3-46ba-83c6-fb0c1513b9bd\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613928052.969308,\r\n" +// + " \"modified\": 1613928095.3507125,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613928053.115541\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613928052.9692612,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/86daf254-e83f-4364-b1ce-dfb348af11ab\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/38b13afd-a8fc-41fa-8dd3-fbc807348881\"\r\n" +// + " },\r\n" +// + " \"_id\": \"38b13afd-a8fc-41fa-8dd3-fbc807348881\",\r\n" +// + " \"id\": \"38b13afd-a8fc-41fa-8dd3-fbc807348881\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613928095.3507106\r\n" +// + " }\r\n" +// + "]"; +// String response_body = "[\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"instantiate\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613908559.4522517,\r\n" +// + " \"modified\": 1613908786.152224,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"lcmOperationType\": \"instantiate\",\r\n" +// + " \"nsdId\": \"f9e6028b-c244-4125-9143-4f218da44ea9\",\r\n" +// + " \"nsName\": \"test1\",\r\n" +// + " \"vimAccountId\": \"e06d0d06-bef6-4678-ac17-77d848d422ba\",\r\n" +// + " \"vnf\": [\r\n" +// + " {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"vimAccountId\": \"e06d0d06-bef6-4678-ac17-77d848d422ba\"\r\n" +// + " }\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"startTime\": 1613908559.4522042,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/62fca486-e858-4f5b-98c5-3dba20f8d553\"\r\n" +// + " },\r\n" +// + " \"_id\": \"62fca486-e858-4f5b-98c5-3dba20f8d553\",\r\n" +// + " \"id\": \"62fca486-e858-4f5b-98c5-3dba20f8d553\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613908786.152222\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909256.2432952,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613909225.026151\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:07:04.882729Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/9d99076b-570c-4e00-b022-ceaa1e65dc26\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909224.8827221,\r\n" +// + " \"_id\": \"9d99076b-570c-4e00-b022-ceaa1e65dc26\",\r\n" +// + " \"id\": \"9d99076b-570c-4e00-b022-ceaa1e65dc26\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909256.243293\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909296.6228228,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613909265.189120\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:07:35.041867Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/6a8a245a-5c4b-488e-a84f-5801f10b2a55\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909255.04186,\r\n" +// + " \"_id\": \"6a8a245a-5c4b-488e-a84f-5801f10b2a55\",\r\n" +// + " \"id\": \"6a8a245a-5c4b-488e-a84f-5801f10b2a55\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909296.6228206\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909331.819041,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613909305.441519\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:08:05.283424Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/96865d6e-1261-4cbe-9533-4b5495a5054d\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909285.283418,\r\n" +// + " \"_id\": \"96865d6e-1261-4cbe-9533-4b5495a5054d\",\r\n" +// + " \"id\": \"96865d6e-1261-4cbe-9533-4b5495a5054d\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909331.8190389\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909335.6219559,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:08:35.521255Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/1ecf8599-2d7f-4e5e-bd33-b79cbb5bad2e\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909315.5212488,\r\n" +// + " \"_id\": \"1ecf8599-2d7f-4e5e-bd33-b79cbb5bad2e\",\r\n" +// + " \"id\": \"1ecf8599-2d7f-4e5e-bd33-b79cbb5bad2e\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909335.621953\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909375.9247396,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:09:35.822264Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/ec20f68d-e7c0-4bd6-9625-3986aecb4a56\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909375.8222575,\r\n" +// + " \"_id\": \"ec20f68d-e7c0-4bd6-9625-3986aecb4a56\",\r\n" +// + " \"id\": \"ec20f68d-e7c0-4bd6-9625-3986aecb4a56\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909375.924737\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909406.1463256,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:10:06.064572Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/fd745050-bc9c-4b82-98db-97c73ebd96f2\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909406.064563,\r\n" +// + " \"_id\": \"fd745050-bc9c-4b82-98db-97c73ebd96f2\",\r\n" +// + " \"id\": \"fd745050-bc9c-4b82-98db-97c73ebd96f2\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909406.1463227\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"nsInstanceId\": \"957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"3964a87d-e098-45c5-ae3b-5f5dced8893d\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909462.8980637,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613909436.376222\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:10:36.234204Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/6f4fffa9-46af-4df5-9503-0cd741959cb4\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909436.2341976,\r\n" +// + " \"_id\": \"6f4fffa9-46af-4df5-9503-0cd741959cb4\",\r\n" +// + " \"id\": \"6f4fffa9-46af-4df5-9503-0cd741959cb4\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909462.8980615\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909436.677574,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:10:36.435677Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/89ce4737-83cd-4014-9e5f-e4c69ac7dc8f\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909436.4356704,\r\n" +// + " \"_id\": \"89ce4737-83cd-4014-9e5f-e4c69ac7dc8f\",\r\n" +// + " \"id\": \"89ce4737-83cd-4014-9e5f-e4c69ac7dc8f\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909436.6775715\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909466.8011858,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:11:06.680565Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/466f1317-608f-45b3-8d1f-ef972e9df18d\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909466.680558,\r\n" +// + " \"_id\": \"466f1317-608f-45b3-8d1f-ef972e9df18d\",\r\n" +// + " \"id\": \"466f1317-608f-45b3-8d1f-ef972e9df18d\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909466.801183\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909527.1077504,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:12:07.009793Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/d3aa410e-ca75-404e-8947-c3e8a560fd2f\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909527.0097864,\r\n" +// + " \"_id\": \"d3aa410e-ca75-404e-8947-c3e8a560fd2f\",\r\n" +// + " \"id\": \"d3aa410e-ca75-404e-8947-c3e8a560fd2f\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909527.1077466\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909557.2773156,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:12:37.175890Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/17b3eaa8-50af-4a7f-81cf-86a333b74bf3\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909557.1758833,\r\n" +// + " \"_id\": \"17b3eaa8-50af-4a7f-81cf-86a333b74bf3\",\r\n" +// + " \"id\": \"17b3eaa8-50af-4a7f-81cf-86a333b74bf3\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909557.2773128\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909587.4373255,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:13:07.346313Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/9e51c559-1d3c-4102-ae30-239423178612\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909587.346306,\r\n" +// + " \"_id\": \"9e51c559-1d3c-4102-ae30-239423178612\",\r\n" +// + " \"id\": \"9e51c559-1d3c-4102-ae30-239423178612\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909587.4373229\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909617.6450963,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:13:37.551139Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/8ab152ba-006a-42fa-bb7a-89613997c5c4\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909617.5511324,\r\n" +// + " \"_id\": \"8ab152ba-006a-42fa-bb7a-89613997c5c4\",\r\n" +// + " \"id\": \"8ab152ba-006a-42fa-bb7a-89613997c5c4\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909617.6450934\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909678.0753574,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:14:37.983770Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/621e38f9-fbcf-49f2-8c85-62cf39b8bc1d\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909677.9837644,\r\n" +// + " \"_id\": \"621e38f9-fbcf-49f2-8c85-62cf39b8bc1d\",\r\n" +// + " \"id\": \"621e38f9-fbcf-49f2-8c85-62cf39b8bc1d\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909678.0753548\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909708.3707678,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:15:08.256051Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/3e17aeda-c027-4750-9bea-6a887521d51e\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909708.25604,\r\n" +// + " \"_id\": \"3e17aeda-c027-4750-9bea-6a887521d51e\",\r\n" +// + " \"id\": \"3e17aeda-c027-4750-9bea-6a887521d51e\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909708.3707652\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909738.3489835,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:15:38.253779Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/87aa1856-545f-43fb-bd08-1d8fc4dbd5f0\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909738.2537727,\r\n" +// + " \"_id\": \"87aa1856-545f-43fb-bd08-1d8fc4dbd5f0\",\r\n" +// + " \"id\": \"87aa1856-545f-43fb-bd08-1d8fc4dbd5f0\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909738.348981\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909768.4961011,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:16:08.413956Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/8fb31d19-265f-4f7c-b2c7-3890c0e53e61\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909768.4139502,\r\n" +// + " \"_id\": \"8fb31d19-265f-4f7c-b2c7-3890c0e53e61\",\r\n" +// + " \"id\": \"8fb31d19-265f-4f7c-b2c7-3890c0e53e61\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909768.4960983\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909768.6613002,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:16:08.573133Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/b16abf83-7f15-4249-9f44-2884a0abc244\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909768.5731268,\r\n" +// + " \"_id\": \"b16abf83-7f15-4249-9f44-2884a0abc244\",\r\n" +// + " \"id\": \"b16abf83-7f15-4249-9f44-2884a0abc244\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909768.6612976\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909869.189726,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:17:49.096628Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/1cd9e694-4c2f-4cde-8a8c-67a9d7927cac\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909869.0966208,\r\n" +// + " \"_id\": \"1cd9e694-4c2f-4cde-8a8c-67a9d7927cac\",\r\n" +// + " \"id\": \"1cd9e694-4c2f-4cde-8a8c-67a9d7927cac\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909869.1897235\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613909929.58234,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:18:49.488232Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/c92013c4-a65d-4d7f-b0a2-7d43281091ae\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613909929.4882257,\r\n" +// + " \"_id\": \"c92013c4-a65d-4d7f-b0a2-7d43281091ae\",\r\n" +// + " \"id\": \"c92013c4-a65d-4d7f-b0a2-7d43281091ae\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613909929.5823371\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910034.2460053,\r\n" +// + " \"modified\": 1613910034.3472185,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910034.2459593,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/189ac178-682b-4b85-8a2e-9a88a6c68638\"\r\n" +// + " },\r\n" +// + " \"_id\": \"189ac178-682b-4b85-8a2e-9a88a6c68638\",\r\n" +// + " \"id\": \"189ac178-682b-4b85-8a2e-9a88a6c68638\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910034.347216\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910094.2656207,\r\n" +// + " \"modified\": 1613910109.8943396,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910094.392173\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910094.265575,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/d732ffcd-138e-4d45-a3a5-835ab5157c7b\"\r\n" +// + " },\r\n" +// + " \"_id\": \"d732ffcd-138e-4d45-a3a5-835ab5157c7b\",\r\n" +// + " \"id\": \"d732ffcd-138e-4d45-a3a5-835ab5157c7b\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910109.894338\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910154.8435988,\r\n" +// + " \"modified\": 1613910186.6822402,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910155.037702\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910154.8435192,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/5c46ada3-4da4-4fbc-a09b-aa61d048f52d\"\r\n" +// + " },\r\n" +// + " \"_id\": \"5c46ada3-4da4-4fbc-a09b-aa61d048f52d\",\r\n" +// + " \"id\": \"5c46ada3-4da4-4fbc-a09b-aa61d048f52d\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910186.6822376\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910214.6640532,\r\n" +// + " \"modified\": 1613910214.7608726,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910214.6640062,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/84215289-3b25-49bd-a49d-ec14dd7ba285\"\r\n" +// + " },\r\n" +// + " \"_id\": \"84215289-3b25-49bd-a49d-ec14dd7ba285\",\r\n" +// + " \"id\": \"84215289-3b25-49bd-a49d-ec14dd7ba285\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910214.7608697\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910274.9706578,\r\n" +// + " \"modified\": 1613910290.6332529,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910275.148673\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910274.970613,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/29bd71cf-1db3-4526-b94d-a725dc88d6e9\"\r\n" +// + " },\r\n" +// + " \"_id\": \"29bd71cf-1db3-4526-b94d-a725dc88d6e9\",\r\n" +// + " \"id\": \"29bd71cf-1db3-4526-b94d-a725dc88d6e9\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910290.6332498\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"nsInstanceId\": \"957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"3964a87d-e098-45c5-ae3b-5f5dced8893d\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613910364.581714,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910322.314141\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:24:52.077444Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/7d0260bb-9c28-4d0a-9c94-92689b29c48a\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910292.077437,\r\n" +// + " \"_id\": \"7d0260bb-9c28-4d0a-9c94-92689b29c48a\",\r\n" +// + " \"id\": \"7d0260bb-9c28-4d0a-9c94-92689b29c48a\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910364.5817118\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910334.381761,\r\n" +// + " \"modified\": 1613910350.0165374,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910334.526976\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910334.3817139,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/bfbdc4a0-a3cc-4fec-abc0-29cbdccc2e32\"\r\n" +// + " },\r\n" +// + " \"_id\": \"bfbdc4a0-a3cc-4fec-abc0-29cbdccc2e32\",\r\n" +// + " \"id\": \"bfbdc4a0-a3cc-4fec-abc0-29cbdccc2e32\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910350.0165346\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"nsInstanceId\": \"957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"3964a87d-e098-45c5-ae3b-5f5dced8893d\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613910429.7995875,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910382.571596\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:25:52.390508Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/50b54f54-f834-4685-9870-d8dce8f5416e\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910352.3905017,\r\n" +// + " \"_id\": \"50b54f54-f834-4685-9870-d8dce8f5416e\",\r\n" +// + " \"id\": \"50b54f54-f834-4685-9870-d8dce8f5416e\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910429.7995856\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910394.5855768,\r\n" +// + " \"modified\": 1613910431.4787664,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910394.721723\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910394.5855281,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/0bbb84f2-05e8-48f2-9504-e29113f140a8\"\r\n" +// + " },\r\n" +// + " \"_id\": \"0bbb84f2-05e8-48f2-9504-e29113f140a8\",\r\n" +// + " \"id\": \"0bbb84f2-05e8-48f2-9504-e29113f140a8\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910431.4787643\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613910443.2732882,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:26:53.165084Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/a9cb6f0f-46d2-4848-a224-a79bfbb73ce0\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910413.165078,\r\n" +// + " \"_id\": \"a9cb6f0f-46d2-4848-a224-a79bfbb73ce0\",\r\n" +// + " \"id\": \"a9cb6f0f-46d2-4848-a224-a79bfbb73ce0\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910443.2732852\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910454.705805,\r\n" +// + " \"modified\": 1613910465.215382,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910454.844086\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910454.7057567,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/234a616c-87f6-45e1-a193-3e953e1f80fb\"\r\n" +// + " },\r\n" +// + " \"_id\": \"234a616c-87f6-45e1-a193-3e953e1f80fb\",\r\n" +// + " \"id\": \"234a616c-87f6-45e1-a193-3e953e1f80fb\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910465.21538\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613910473.6185863,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:27:53.523440Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/a3756a3c-7c77-4f6f-b145-89e8d1be8a30\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910473.5234346,\r\n" +// + " \"_id\": \"a3756a3c-7c77-4f6f-b145-89e8d1be8a30\",\r\n" +// + " \"id\": \"a3756a3c-7c77-4f6f-b145-89e8d1be8a30\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910473.618584\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910515.3454695,\r\n" +// + " \"modified\": 1613910541.7016327,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910515.565245\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910515.3453994,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/9ce258c7-8424-4ab9-bda7-bf21920a5fac\"\r\n" +// + " },\r\n" +// + " \"_id\": \"9ce258c7-8424-4ab9-bda7-bf21920a5fac\",\r\n" +// + " \"id\": \"9ce258c7-8424-4ab9-bda7-bf21920a5fac\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910541.701631\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"nsInstanceId\": \"957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"3964a87d-e098-45c5-ae3b-5f5dced8893d\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613910570.9613228,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910534.252119\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:28:54.093851Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/bcc40603-7a36-46c0-bd1b-edc9c5bdd066\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910534.0938444,\r\n" +// + " \"_id\": \"bcc40603-7a36-46c0-bd1b-edc9c5bdd066\",\r\n" +// + " \"id\": \"bcc40603-7a36-46c0-bd1b-edc9c5bdd066\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910570.9613204\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910575.2397785,\r\n" +// + " \"modified\": 1613910590.870802,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910575.392916\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910575.2397187,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/73cfbe6b-c3a1-4b0e-aab3-3c80a365773b\"\r\n" +// + " },\r\n" +// + " \"_id\": \"73cfbe6b-c3a1-4b0e-aab3-3c80a365773b\",\r\n" +// + " \"id\": \"73cfbe6b-c3a1-4b0e-aab3-3c80a365773b\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910590.8707998\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"nsInstanceId\": \"957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"3964a87d-e098-45c5-ae3b-5f5dced8893d\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"modified\": 1613910626.0078642,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910594.628977\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"scaleTime\": \"2021-02-21T12:29:54.468485Z\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/957f161d-b2b8-4ec7-a2f2-48195fe6ae8a\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/db048e5a-bd83-48c7-8218-a37b29466080\"\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910594.4684794,\r\n" +// + " \"_id\": \"db048e5a-bd83-48c7-8218-a37b29466080\",\r\n" +// + " \"id\": \"db048e5a-bd83-48c7-8218-a37b29466080\",\r\n" +// + " \"isAutomaticInvocation\": true,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910626.0078623\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910635.138362,\r\n" +// + " \"modified\": 1613910677.2629888,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910635.279426\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910635.138297,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/8bb32fd9-68bd-48fb-8f64-1bc5816fb911\"\r\n" +// + " },\r\n" +// + " \"_id\": \"8bb32fd9-68bd-48fb-8f64-1bc5816fb911\",\r\n" +// + " \"id\": \"8bb32fd9-68bd-48fb-8f64-1bc5816fb911\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910677.2629857\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910694.940018,\r\n" +// + " \"modified\": 1613910710.5964007,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910695.072941\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910694.9399714,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/1533bb7f-9260-4fc3-aab5-5dbcb64aca23\"\r\n" +// + " },\r\n" +// + " \"_id\": \"1533bb7f-9260-4fc3-aab5-5dbcb64aca23\",\r\n" +// + " \"id\": \"1533bb7f-9260-4fc3-aab5-5dbcb64aca23\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910710.5963984\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910755.0686476,\r\n" +// + " \"modified\": 1613910797.2895927,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910755.216604\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910755.0685987,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/1527f671-f917-4421-bd34-918b3ad09fea\"\r\n" +// + " },\r\n" +// + " \"_id\": \"1527f671-f917-4421-bd34-918b3ad09fea\",\r\n" +// + " \"id\": \"1527f671-f917-4421-bd34-918b3ad09fea\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910797.2895906\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910815.0303142,\r\n" +// + " \"modified\": 1613910846.841692,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910815.214299\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910815.0302649,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/a06b303b-f7f7-40ca-b5ff-fec58bb5fa75\"\r\n" +// + " },\r\n" +// + " \"_id\": \"a06b303b-f7f7-40ca-b5ff-fec58bb5fa75\",\r\n" +// + " \"id\": \"a06b303b-f7f7-40ca-b5ff-fec58bb5fa75\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910846.84169\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910874.8476086,\r\n" +// + " \"modified\": 1613910890.4736896,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910874.985552\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910874.847478,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/9bbc24ff-feac-4006-af36-dcb4afabdf09\"\r\n" +// + " },\r\n" +// + " \"_id\": \"9bbc24ff-feac-4006-af36-dcb4afabdf09\",\r\n" +// + " \"id\": \"9bbc24ff-feac-4006-af36-dcb4afabdf09\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910890.473688\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910935.1008294,\r\n" +// + " \"modified\": 1613910945.6500735,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910935.269509\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910935.100782,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/b899e50b-bd61-425b-8922-5e9ccdfd9178\"\r\n" +// + " },\r\n" +// + " \"_id\": \"b899e50b-bd61-425b-8922-5e9ccdfd9178\",\r\n" +// + " \"id\": \"b899e50b-bd61-425b-8922-5e9ccdfd9178\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613910945.6500702\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613910996.4660888,\r\n" +// + " \"modified\": 1613911033.2293398,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613910996.656248\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613910996.466044,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/f53b8dc3-fdf4-4c20-902a-7cc2c23b3b99\"\r\n" +// + " },\r\n" +// + " \"_id\": \"f53b8dc3-fdf4-4c20-902a-7cc2c23b3b99\",\r\n" +// + " \"id\": \"f53b8dc3-fdf4-4c20-902a-7cc2c23b3b99\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911033.229338\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911050.5486434,\r\n" +// + " \"modified\": 1613911066.225315,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911050.688298\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911050.548594,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/69e4b810-1fe9-438d-a31b-6cf9b31d45f7\"\r\n" +// + " },\r\n" +// + " \"_id\": \"69e4b810-1fe9-438d-a31b-6cf9b31d45f7\",\r\n" +// + " \"id\": \"69e4b810-1fe9-438d-a31b-6cf9b31d45f7\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911066.225313\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911110.5881708,\r\n" +// + " \"modified\": 1613911121.0799134,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911110.750472\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911110.5881114,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/28d548bb-daaf-4c13-93fc-094907981564\"\r\n" +// + " },\r\n" +// + " \"_id\": \"28d548bb-daaf-4c13-93fc-094907981564\",\r\n" +// + " \"id\": \"28d548bb-daaf-4c13-93fc-094907981564\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911121.0799115\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 0 (min-instance-count) scaling-in operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 0 (min-instance-count) scaling-in operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911171.1116796,\r\n" +// + " \"modified\": 1613911171.1979456,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911171.1116383,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/3eae096d-2f05-4fdd-ab3e-a347183591e2\"\r\n" +// + " },\r\n" +// + " \"_id\": \"3eae096d-2f05-4fdd-ab3e-a347183591e2\",\r\n" +// + " \"id\": \"3eae096d-2f05-4fdd-ab3e-a347183591e2\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911171.1979434\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 0 (min-instance-count) scaling-in operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 0 (min-instance-count) scaling-in operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911230.813983,\r\n" +// + " \"modified\": 1613911230.8896387,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911230.8139443,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/9ac0c28e-76ae-47aa-9bca-d103bc5e84c6\"\r\n" +// + " },\r\n" +// + " \"_id\": \"9ac0c28e-76ae-47aa-9bca-d103bc5e84c6\",\r\n" +// + " \"id\": \"9ac0c28e-76ae-47aa-9bca-d103bc5e84c6\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911230.8896365\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 0 (min-instance-count) scaling-in operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 0 (min-instance-count) scaling-in operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911383.1045403,\r\n" +// + " \"modified\": 1613911383.2016208,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911383.1044917,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/1f0f5e6b-7718-4d3d-a280-652d9eb3d13f\"\r\n" +// + " },\r\n" +// + " \"_id\": \"1f0f5e6b-7718-4d3d-a280-652d9eb3d13f\",\r\n" +// + " \"id\": \"1f0f5e6b-7718-4d3d-a280-652d9eb3d13f\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911383.2016182\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911439.4396203,\r\n" +// + " \"modified\": 1613911465.6242385,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911439.585795\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911439.4395723,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/a81e4764-481f-4518-91d3-ae3ce8cb305d\"\r\n" +// + " },\r\n" +// + " \"_id\": \"a81e4764-481f-4518-91d3-ae3ce8cb305d\",\r\n" +// + " \"id\": \"a81e4764-481f-4518-91d3-ae3ce8cb305d\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911465.6242363\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911499.3622625,\r\n" +// + " \"modified\": 1613911514.9143875,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911499.498071\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911499.3622153,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/5890fedb-800b-4e67-93d6-db15ff706895\"\r\n" +// + " },\r\n" +// + " \"_id\": \"5890fedb-800b-4e67-93d6-db15ff706895\",\r\n" +// + " \"id\": \"5890fedb-800b-4e67-93d6-db15ff706895\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911514.9143853\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911559.2898803,\r\n" +// + " \"modified\": 1613911595.531617,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911559.436866\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911559.2898374,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/8bfe4851-c453-4ffb-8806-1b39e86fde8e\"\r\n" +// + " },\r\n" +// + " \"_id\": \"8bfe4851-c453-4ffb-8806-1b39e86fde8e\",\r\n" +// + " \"id\": \"8bfe4851-c453-4ffb-8806-1b39e86fde8e\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911595.5316153\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911620.0033092,\r\n" +// + " \"modified\": 1613911635.637214,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911620.148513\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911620.0032625,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/1c692144-803a-4815-b47a-b000ef7a914a\"\r\n" +// + " },\r\n" +// + " \"_id\": \"1c692144-803a-4815-b47a-b000ef7a914a\",\r\n" +// + " \"id\": \"1c692144-803a-4815-b47a-b000ef7a914a\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911635.6372118\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911679.276305,\r\n" +// + " \"modified\": 1613911716.0668747,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911679.438384\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911679.2762609,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/facf2b4a-0a8c-4bff-acfd-9b054fcbf57f\"\r\n" +// + " },\r\n" +// + " \"_id\": \"facf2b4a-0a8c-4bff-acfd-9b054fcbf57f\",\r\n" +// + " \"id\": \"facf2b4a-0a8c-4bff-acfd-9b054fcbf57f\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911716.0668714\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911739.6183205,\r\n" +// + " \"modified\": 1613911750.1136234,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911739.747430\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911739.6182737,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/63ad2615-f034-4386-9c79-3590ae44bbdf\"\r\n" +// + " },\r\n" +// + " \"_id\": \"63ad2615-f034-4386-9c79-3590ae44bbdf\",\r\n" +// + " \"id\": \"63ad2615-f034-4386-9c79-3590ae44bbdf\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911750.1136212\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911799.2334297,\r\n" +// + " \"modified\": 1613911841.2871606,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911799.363900\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911799.2333803,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/98a025c6-f9c1-4f2f-881a-97091aead12d\"\r\n" +// + " },\r\n" +// + " \"_id\": \"98a025c6-f9c1-4f2f-881a-97091aead12d\",\r\n" +// + " \"id\": \"98a025c6-f9c1-4f2f-881a-97091aead12d\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911841.2871587\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"type\": \"delete\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911859.3068163,\r\n" +// + " \"modified\": 1613911874.888463,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911859.466150\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_IN\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911859.3067691,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/00fa47c7-a987-4705-b500-c84e05eb3131\"\r\n" +// + " },\r\n" +// + " \"_id\": \"00fa47c7-a987-4705-b500-c84e05eb3131\",\r\n" +// + " \"id\": \"00fa47c7-a987-4705-b500-c84e05eb3131\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911874.8884618\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911919.2559352,\r\n" +// + " \"modified\": 1613911961.0181375,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911919.429585\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911919.255896,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/9acdaa1c-d7f0-4173-ab0a-52499e3e26c6\"\r\n" +// + " },\r\n" +// + " \"_id\": \"9acdaa1c-d7f0-4173-ab0a-52499e3e26c6\",\r\n" +// + " \"id\": \"9acdaa1c-d7f0-4173-ab0a-52499e3e26c6\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613911961.0181353\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613911979.2063522,\r\n" +// + " \"modified\": 1613912010.748398,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613911979.363413\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613911979.2062573,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/b2f86ede-4545-4263-9b87-a226750886e4\"\r\n" +// + " },\r\n" +// + " \"_id\": \"b2f86ede-4545-4263-9b87-a226750886e4\",\r\n" +// + " \"id\": \"b2f86ede-4545-4263-9b87-a226750886e4\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613912010.748396\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"errorMessage\": null,\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"operations\": [\r\n" +// + " {\r\n" +// + " \"vdu_id\": null,\r\n" +// + " \"primitive\": null,\r\n" +// + " \"vdu_count_index\": null,\r\n" +// + " \"detailed-status\": \"Done\",\r\n" +// + " \"lcmOperationType\": \"SCALE-RO\",\r\n" +// + " \"operationState\": \"COMPLETED\",\r\n" +// + " \"RO_nsr_id\": \"1ced6a58-39fd-449c-a308-019b5aababa6\",\r\n" +// + " \"RO_scaling_info\": [\r\n" +// + " {\r\n" +// + " \"osm_vdu_id\": \"apache_vdu\",\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"count\": 1,\r\n" +// + " \"cloud_init\": [\r\n" +// + " \"#cloud-config\\nhostname: ubuntu\\npassword: hi\\nchpasswd: { expire: False }\\nssh_pwauth: True\"\r\n" +// + " ],\r\n" +// + " \"type\": \"create\"\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"member_vnf_index\": \"1\",\r\n" +// + " \"primitive_params\": null\r\n" +// + " }\r\n" +// + " ],\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613912039.3231254,\r\n" +// + " \"modified\": 1613912076.0972588,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"deploy\": {\r\n" +// + " \"RO\": \"ACTION-1613912039.461176\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613912039.3230777,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/bb155452-4044-4750-a0ec-b1ff15ecf6ad\"\r\n" +// + " },\r\n" +// + " \"_id\": \"bb155452-4044-4750-a0ec-b1ff15ecf6ad\",\r\n" +// + " \"id\": \"bb155452-4044-4750-a0ec-b1ff15ecf6ad\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613912076.0972567\r\n" +// + " },\r\n" +// + " {\r\n" +// + " \"queuePosition\": 0,\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"detailed-status\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"operationState\": \"FAILED\",\r\n" +// + " \"errorMessage\": \"FAILED Sending scale order to VIM: reached the limit of 3 (max-instance-count) scaling-out operations for the scaling-group-descriptor 'apache_vdu_autoscale'\",\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"_admin\": {\r\n" +// + " \"projects_write\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ],\r\n" +// + " \"created\": 1613912098.5701716,\r\n" +// + " \"modified\": 1613912098.681397,\r\n" +// + " \"worker\": \"dd52ddce9643\",\r\n" +// + " \"projects_read\": [\r\n" +// + " \"44f213c8-49ff-40be-b670-e89fef7f25ed\"\r\n" +// + " ]\r\n" +// + " },\r\n" +// + " \"detailedStatus\": null,\r\n" +// + " \"stage\": \"\",\r\n" +// + " \"operationParams\": {\r\n" +// + " \"nsInstanceId\": \"b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"scaleType\": \"SCALE_VNF\",\r\n" +// + " \"lcmOperationType\": \"scale\",\r\n" +// + " \"scaleVnfData\": {\r\n" +// + " \"scaleByStepData\": {\r\n" +// + " \"member-vnf-index\": \"1\",\r\n" +// + " \"scaling-group-descriptor\": \"apache_vdu_autoscale\"\r\n" +// + " },\r\n" +// + " \"scaleVnfType\": \"SCALE_OUT\"\r\n" +// + " }\r\n" +// + " },\r\n" +// + " \"startTime\": 1613912098.5701249,\r\n" +// + " \"links\": {\r\n" +// + " \"nsInstance\": \"/osm/nslcm/v1/ns_instances/b87a6b38-2f46-4b65-9791-f86f482ec267\",\r\n" +// + " \"self\": \"/osm/nslcm/v1/ns_lcm_op_occs/a1cbf62f-1b32-4788-9da6-3a9fdafd3ef9\"\r\n" +// + " },\r\n" +// + " \"_id\": \"a1cbf62f-1b32-4788-9da6-3a9fdafd3ef9\",\r\n" +// + " \"id\": \"a1cbf62f-1b32-4788-9da6-3a9fdafd3ef9\",\r\n" +// + " \"isAutomaticInvocation\": false,\r\n" +// + " \"isCancelPending\": false,\r\n" +// + " \"statusEnteredTime\": 1613912098.6813943\r\n" +// + " }\r\n" +// + "]"; +//// System.out.println("Round 1"); +//// String output = getNSLCMDetailsListByNSID(response_body, "b87a6b38-2f46-4b65-9791-f86f482ec267"); +//// System.out.println(output); +//// System.out.println("Round 2"); +//// output = getNSLCMDetailsListByNSID(output, "b87a6b38-2f46-4b65-9791-f86f482ec267"); +//// System.out.println(output); +//// System.out.println("Round 3"); +//// output = getNSLCMDetailsListByNSID(output, "b87a6b38-2f46-4b65-9791-f86f482ec267"); +//// System.out.println(output); +// System.out.println(compareNSLCMDetailsScaleOpsList(current, current)); +// System.out.println(compareNSLCMDetailsScaleOpsList(current, current).length()); +// } +// +// public static JSONArray compareNSLCMDetailsScaleOpsList(String previous, String current) +// { +// JSONArray result = new JSONArray(); +// try { +// JSONArray array = new JSONArray(previous); +// JSONArray array2 = new JSONArray(current); +// if(array.length()%s
", this.nsDescriptor.getName() ); + fmt.format("%s: %s
", "Vendor", nsDescriptor.getDesigner()); + fmt.format("%s: %s
", "Version", nsDescriptor.getVersion()); + fmt.format("%s: %s
", "Description", nsDescriptor.getName()); + if ( nsDescriptor.getDf() != null ) { + fmt.format("%s: %d
", "VNF Count", nsDescriptor.getDf().size()); + } + + fmt.format("%s: %d
", "VM Count", vmCount); + fmt.format("%s: %d
", "vCPU Count", vcpuCount); + fmt.format("%s: %d MB
", "Memory", memoryMB); + fmt.format("%s: %d GB
", "Storage", storageGB); + + fmt.format("

%s


", "ConstituentVnfds" ); + if ( nsDescriptor.getDf() != null ) { + @Nullable Map vl = nsDescriptor.getDf(); + for (Df df : vl.values()) { + fmt.format("%s: %s
", "VnfdId", df.getId()); + } + } + + + return stringBuilder.toString(); + } + + @Override + public String toString() { + return "NSRequirements{" + + "nsName=" + nsDescriptor.getName() + + ", memoryMB=" + memoryMB + + ", storageGB=" + storageGB + + ", vcpuCount=" + vcpuCount + + ", vmCount=" + vmCount + + '}'; + } +} diff --git a/src/main/java/OSM10Util/OSM10VNFReq/OSM10VNFRequirements.java b/src/main/java/OSM10Util/OSM10VNFReq/OSM10VNFRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..e8ef42a1017481a10c4e6b9497b4f7a649de71cb --- /dev/null +++ b/src/main/java/OSM10Util/OSM10VNFReq/OSM10VNFRequirements.java @@ -0,0 +1,92 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol005nbi.osm10 + * %% + * Copyright (C) 2019 openslice.io + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * =========================LICENSE_END================================== + */ +package OSM10Util.OSM10VNFReq; + +import java.util.Formatter; +import java.util.Map; + +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDescKey; + +public class OSM10VNFRequirements { + public Vnfd descriptor; + + public boolean unknownFields = false; + public int memoryMB = 0; + public int storageGB = 0; + public int vcpuCount = 0; + public int vmCount = 0; + + public OSM10VNFRequirements() + {} + + public OSM10VNFRequirements(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd vnfHackfestMultiVduDescriptor) { + this.descriptor = vnfHackfestMultiVduDescriptor; + + this.memoryMB = 0; + this.storageGB = 0; + this.vcpuCount = 0; + this.vmCount = 0; + Map virtualComputeDescMap = vnfHackfestMultiVduDescriptor.getVirtualComputeDesc(); + if ( virtualComputeDescMap != null) { + for(VirtualComputeDesc tmp : virtualComputeDescMap.values()) + { + this.memoryMB = tmp.getVirtualMemory().getSize().intValue(); + this.vcpuCount = tmp.getVirtualCpu().getNumVirtualCpu().intValue(); + this.vmCount++; + } + Map virtualStorageDescMap = vnfHackfestMultiVduDescriptor.getVirtualStorageDesc(); + for(VirtualStorageDesc tmp : virtualStorageDescMap.values()) + { + this.storageGB = tmp.getSizeOfStorage().intValue(); + } + } + + } + + public String toHTML() { + StringBuilder stringBuilder = new StringBuilder(); + Formatter fmt = new Formatter(stringBuilder); + fmt.format("

%s


", descriptor.getProductName()); + fmt.format("%s: %s
", "Vendor", descriptor.getProvider() ); + fmt.format("%s: %s
", "Version", descriptor.getVersion() ); + fmt.format("%s: %s
", "Description", descriptor.getProductInfoDescription()); + fmt.format("%s: %d
", "VM Count", vmCount); + fmt.format("%s: %d
", "vCPU Count", vcpuCount); + fmt.format("%s: %d MB
", "Memory", memoryMB); + fmt.format("%s: %d GB
", "Storage", storageGB); + + return stringBuilder.toString(); + } + + @Override + public String toString() { + return "VNFRequirements{" + + "vnfName=" + descriptor.getProductName() + + ", memoryMB=" + memoryMB + + ", storageGB=" + storageGB + + ", vcpuCount=" + vcpuCount + + ", vmCount=" + vmCount + + '}'; + } +} diff --git a/src/main/java/OSM10Util/examples/Example.java b/src/main/java/OSM10Util/examples/Example.java new file mode 100644 index 0000000000000000000000000000000000000000..4f12a14d1eee5d85760fdc061823a49f6d2307be --- /dev/null +++ b/src/main/java/OSM10Util/examples/Example.java @@ -0,0 +1,83 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol005nbi.osm10 + * %% + * Copyright (C) 2019 openslice.io + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * =========================LICENSE_END================================== + */ +package OSM10Util.examples; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.Map; + +import org.apache.commons.io.FileUtils; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VnfProfile; + +import OSM10Util.OSM10ArchiveExtractor.OSM10NSExtractor; +import OSM10Util.OSM10ArchiveExtractor.OSM10VNFDExtractor; +import OSM10Util.OSM10NSReq.OSM10NSRequirements; +import OSM10Util.OSM10VNFReq.OSM10VNFRequirements; + + + +public class Example { + //private static URL cirrosVnfUrl; + //private static URL hackfest1VnfUrl; + //private static URL hackfest2VnfUrl; + //private static URL pingPongNsUrl; + private static URL hackfestMultiVduUrl; + private static URL hackfestMultiVduNSUrl; + + public static void main(String[] args) throws IOException { + hackfestMultiVduUrl = new URL("http://localhost/osm/hackfest_multivdu_vnf.tar.gz"); + hackfestMultiVduNSUrl = new URL("http://localhost/osm/hackfest_multivdu_ns.tar.gz"); + + File hackfestMultiVduFile = File.createTempFile("hackfest_multivdu_vnf", ".tar.gz"); + File hackfestMultiVduNSFile = File.createTempFile("hackfest_multivdu_ns", ".tar.gz"); + //File pingPongNsFile = File.createTempFile("ping_pong_ns", ".tar.gz"); + + hackfestMultiVduFile.deleteOnExit(); + hackfestMultiVduNSFile.deleteOnExit(); + + System.out.println("Downloading VNF"); + + FileUtils.copyURLToFile(hackfestMultiVduUrl, hackfestMultiVduFile); + FileUtils.copyURLToFile(hackfestMultiVduNSUrl, hackfestMultiVduNSFile); + + System.out.println("Calculating requirements..."); + + OSM10VNFDExtractor vnfHackfestMultiVduExtract = new OSM10VNFDExtractor(hackfestMultiVduFile.getPath()); + Vnfd vnfHackfestMultiVduDescriptor = vnfHackfestMultiVduExtract.extractVnfdDescriptor(); + System.out.println(vnfHackfestMultiVduDescriptor.toString()); + OSM10VNFRequirements vnfHackfestMultiVduRequirements = new OSM10VNFRequirements(vnfHackfestMultiVduDescriptor); + System.out.println(vnfHackfestMultiVduRequirements.toHTML()); + OSM10NSExtractor nsExtractor = new OSM10NSExtractor(hackfestMultiVduNSFile); + Nsd hackfestMultiVduNSDescriptor = nsExtractor.extractNsDescriptor(); + OSM10NSRequirements hackfestMultiVduNSRequirements = new OSM10NSRequirements(hackfestMultiVduNSDescriptor); + + for (Df v : hackfestMultiVduNSDescriptor.getDf().values()) { + for( VnfProfile q : v.getVnfProfile().values()) + { + System.out.println("setMemberVNFIndex: "+Integer.parseInt(q.getId())); + System.out.println("setVNFDIdRef: "+(String) q.getVnfdId()); + } + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..710b8fa2cc762c6eca2169dc3ea1492b497d558e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..debda92eab6df17345e79277c6923e1b3bece9dd --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/$YangModuleInfoImpl.java @@ -0,0 +1,173 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:nfv:yang:etsi-nfv-descriptors", "2019-04-25", "etsi-nfv-descriptors").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(EtsiNfvNsInfo.getInstance()); + set.add(EtsiNfvCommonInfo.getInstance()); + set.add(EtsiNfvVnfInfo.getInstance()); + set.add(EtsiNfvPnfInfo.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/etsi-nfv-descriptors@2019-04-25.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } + + private static final class EtsiNfvNsInfo extends ResourceYangModuleInfo { + private final @NonNull QName NAME = QName.create("urn:etsi:nfv:yang:etsi-nfv-descriptors", "2019-04-25", "etsi-nfv-ns").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new EtsiNfvNsInfo(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + private EtsiNfvNsInfo() { + importedModules = ImmutableSet.of(); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/etsi-nfv-ns@2019-04-25.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } + } + + private static final class EtsiNfvCommonInfo extends ResourceYangModuleInfo { + private final @NonNull QName NAME = QName.create("urn:etsi:nfv:yang:etsi-nfv-descriptors", "2019-04-25", "etsi-nfv-common").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new EtsiNfvCommonInfo(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + private EtsiNfvCommonInfo() { + importedModules = ImmutableSet.of(); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/etsi-nfv-common@2019-04-25.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } + } + + private static final class EtsiNfvVnfInfo extends ResourceYangModuleInfo { + private final @NonNull QName NAME = QName.create("urn:etsi:nfv:yang:etsi-nfv-descriptors", "2019-03-18", "etsi-nfv-vnf").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new EtsiNfvVnfInfo(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + private EtsiNfvVnfInfo() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.$YangModuleInfoImpl.getInstance()); + set.add(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/etsi-nfv-vnf@2019-03-18.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } + } + + private static final class EtsiNfvPnfInfo extends ResourceYangModuleInfo { + private final @NonNull QName NAME = QName.create("urn:etsi:nfv:yang:etsi-nfv-descriptors", "2019-04-25", "etsi-nfv-pnf").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new EtsiNfvPnfInfo(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + private EtsiNfvPnfInfo() { + importedModules = ImmutableSet.of(); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/etsi-nfv-pnf@2019-04-25.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/AddressType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/AddressType.java new file mode 100644 index 0000000000000000000000000000000000000000..e3311f1a41e479a6555b4aed9269343bea8400ce --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/AddressType.java @@ -0,0 +1,32 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.BaseIdentity; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes the type of the address to be assigned to the CP instantiated from + * parent CPD. Value: • MAC address. • IP address. • … The content type shall be + * aligned with the address type supported by the layerProtocol attribute of the + * parent CPD. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity address-type {
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/address-type + * + */ +public interface AddressType + extends + BaseIdentity +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("address-type"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/AffinityScope.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/AffinityScope.java new file mode 100644 index 0000000000000000000000000000000000000000..7ede8794e0630c5c68ce5f013b8f09068c72764d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/AffinityScope.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.opendaylight.yangtools.yang.binding.Enumeration; + +public enum AffinityScope implements Enumeration { + NfviNode(0, "nfvi-node"), + + ZoneGroup(1, "zone-group"), + + Zone(2, "zone"), + + NfviPop(3, "nfvi-pop") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (AffinityScope enumItem : AffinityScope.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private AffinityScope(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding AffinityScope item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding AffinityScope item, or null if no such item exists + */ + public static AffinityScope forValue(int intValue) { + return VALUE_MAP.get(intValue); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/AffinityType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/AffinityType.java new file mode 100644 index 0000000000000000000000000000000000000000..b32148b52df86650489e4f778dcbdd0de32353b8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/AffinityType.java @@ -0,0 +1,71 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.opendaylight.yangtools.yang.binding.Enumeration; + +public enum AffinityType implements Enumeration { + Affinity(0, "affinity"), + + AntiAffinity(1, "anti-affinity") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (AffinityType enumItem : AffinityType.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private AffinityType(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding AffinityType item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding AffinityType item, or null if no such item exists + */ + public static AffinityType forValue(int intValue) { + return VALUE_MAP.get(intValue); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ChangeVnfFlavour.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ChangeVnfFlavour.java new file mode 100644 index 0000000000000000000000000000000000000000..8db3309c5c1d2b2134668e7582d528489d599589 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ChangeVnfFlavour.java @@ -0,0 +1,29 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This operation changes the DF of a VNF instance. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity change-vnf-flavour {
+ *   base supported-operation;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/change-vnf-flavour + * + */ +public interface ChangeVnfFlavour + extends + SupportedOperation +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("change-vnf-flavour"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ChecksumAlgorithm.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ChecksumAlgorithm.java new file mode 100644 index 0000000000000000000000000000000000000000..e97ae86c6c9abea56f41280ea4ad9aa437328611 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ChecksumAlgorithm.java @@ -0,0 +1,29 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.BaseIdentity; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Identifies the algorithms supported for the purpose of calculating the checksum. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity checksum-algorithm {
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/checksum-algorithm + * + */ +public interface ChecksumAlgorithm + extends + BaseIdentity +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("checksum-algorithm"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ConnectivityType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ConnectivityType.java new file mode 100644 index 0000000000000000000000000000000000000000..ee2e87aea7edaf5f70488baadb16244f588fe226 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ConnectivityType.java @@ -0,0 +1,48 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping connectivity-type {
+ *   container connectivity-type {
+ *     leaf-list layer-protocol {
+ *       type identityref {
+ *         base layer-protocol;
+ *       }
+ *     }
+ *     leaf flow-pattern {
+ *       type flow-pattern;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/connectivity-type + * + */ +public interface ConnectivityType + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("connectivity-type"); + + @Override + Class implementedInterface(); + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.connectivity.type.ConnectivityType connectivityType, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.connectivity.type.@Nullable ConnectivityType getConnectivityType(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/CpRole.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/CpRole.java new file mode 100644 index 0000000000000000000000000000000000000000..2b5c8b0da3e5f633c75aacb349bd0920c7f467de --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/CpRole.java @@ -0,0 +1,30 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.BaseIdentity; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Identifies the role of the port in the context of the traffic flow patterns in + * the VNF or parent NS. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity cp-role {
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/cp-role + * + */ +public interface CpRole + extends + BaseIdentity +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("cp-role"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Cpd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Cpd.java new file mode 100644 index 0000000000000000000000000000000000000000..adfbda8ea77147281e7a4883e9c12ab4e8ccbb5b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Cpd.java @@ -0,0 +1,175 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.Protocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.ProtocolKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * A Cpd information element describes network connectivity to a compute resource + * or a VL. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping cpd {
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf-list layer-protocol {
+ *     default ethernet;
+ *     type identityref {
+ *       base layer-protocol;
+ *     }
+ *   }
+ *   leaf role {
+ *     type identityref {
+ *       base cp-role;
+ *     }
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   list protocol {
+ *     key associated-layer-protocol;
+ *     leaf associated-layer-protocol {
+ *       type identityref {
+ *         base layer-protocol;
+ *       }
+ *     }
+ *     list address-data {
+ *       key type;
+ *       leaf type {
+ *         type identityref {
+ *           base address-type;
+ *         }
+ *       }
+ *       container l2-address-data {
+ *         when "../type='mac-address'";
+ *         leaf mac-address-assignment {
+ *           type boolean;
+ *         }
+ *       }
+ *       container l3-address-data {
+ *         when "../type='ip-address'";
+ *         leaf ip-address-assignment {
+ *           type boolean;
+ *         }
+ *         leaf floating-ip-activated {
+ *           type boolean;
+ *         }
+ *         leaf ip-address-type {
+ *           type enumeration {
+ *             enum ipv4;
+ *             enum ipv6;
+ *           }
+ *         }
+ *         leaf number-of-ip-addresses {
+ *           type uint32;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   leaf trunk-mode {
+ *     type boolean;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/cpd + * + */ +public interface Cpd + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("cpd"); + + @Override + Class implementedInterface(); + + /** + * Identifier of this Cpd information element. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Identifies a protocol that the connection points corresponding to the CPD + * support for connectivity purposes (e.g. Ethernet, MPLS, ODU2, IPV4, IPV6, + * Pseudo-Wire, etc.). + * + * + * + * @return java.util.List layerProtocol, or null if not present + */ + @Nullable List> getLayerProtocol(); + + /** + * Identifies the role of the connection points corresponding to the CPD in the + * context of the traffic flow patterns in the VNF, PNF or NS. For example an NS + * with a tree flow pattern within the NS will have legal cpRoles of ROOT and LEAF. + * + * + * + * @return java.lang.Class role, or null if not present + */ + @Nullable Class getRole(); + + /** + * Provides human-readable information on the purpose of the connection point (e.g. + * connection point for control plane traffic). + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * Identifies the protocol layering information the CP uses for connectivity + * purposes and associated information. There shall be one cpProtocol for each + * layer protocol as indicated by the attribute layerProtocol. When a PnfExtCpd as + * defined in ETSI GS NFV-IFA 014 [i.8] is inherited from this Cpd, the cardinality + * is set to 0. + * + * + * + * @return java.util.Map protocol, or null if not present + */ + @Nullable Map getProtocol(); + + /** + * @return java.util.Map protocol, or an empty list if it is not present + */ + default @NonNull Map nonnullProtocol() { + return CodeHelpers.nonnull(getProtocol()); + } + + /** + * Information about whether the Cp instantiated from this CPD is in Trunk mode + * (802.1Q or other). When operating in 'trunk mode', the Cp is capable of carrying + * traffic for several VLANs. A cardinality of 0 implies that trunkMode is not + * configured for the Cp i.e. It is equivalent to Boolean value 'false'. + * + * + * + * @return java.lang.Boolean trunkMode, or null if not present + */ + @Nullable Boolean isTrunkMode(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/EphemeralStorage.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/EphemeralStorage.java new file mode 100644 index 0000000000000000000000000000000000000000..da1a7ea1aefb8ff1aa932f945196a8766f409d1b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/EphemeralStorage.java @@ -0,0 +1,29 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Ephemeral type of storage. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity ephemeral-storage {
+ *   base storage-type;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/ephemeral-storage + * + */ +public interface EphemeralStorage + extends + StorageType +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ephemeral-storage"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Ethernet.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Ethernet.java new file mode 100644 index 0000000000000000000000000000000000000000..d8752a1d4c77de3f24591139987f0a59389f7a81 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Ethernet.java @@ -0,0 +1,28 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity ethernet {
+ *   base layer-protocol;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/ethernet + * + */ +public interface Ethernet + extends + LayerProtocol +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ethernet"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/EtsiNfvDescriptorsData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/EtsiNfvDescriptorsData.java new file mode 100644 index 0000000000000000000000000000000000000000..de70e2748c116702b8f419b470c2aac3f171bc6b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/EtsiNfvDescriptorsData.java @@ -0,0 +1,53 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataRoot; + +/** + * Network Function Virtualization Descriptors + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * module etsi-nfv-descriptors {
+ *   yang-version 1.1;
+ *   namespace urn:etsi:nfv:yang:etsi-nfv-descriptors;
+ *   prefix nfv;
+ *   include etsi-nfv-common;
+ *   include etsi-nfv-ns;
+ *   include etsi-nfv-vnf;
+ *   include etsi-nfv-pnf;
+ *   revision 2019-04-25 {
+ *   }
+ *   container nfv {
+ *     list vnfd {
+ *       key id;
+ *       uses vnfd;
+ *     }
+ *     list nsd {
+ *       key id;
+ *       uses nsd;
+ *     }
+ *     list pnfd {
+ *       key id;
+ *       uses pnfd;
+ *     }
+ *   }
+ * }
+ * 
+ * + */ +public interface EtsiNfvDescriptorsData + extends + DataRoot +{ + + + + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nfv nfv, or null if not present + */ + @Nullable Nfv getNfv(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/FlowPattern.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/FlowPattern.java new file mode 100644 index 0000000000000000000000000000000000000000..ce428437949d81e72fb3d20e619ebd322e94368c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/FlowPattern.java @@ -0,0 +1,73 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.opendaylight.yangtools.yang.binding.Enumeration; + +public enum FlowPattern implements Enumeration { + Line(0, "line"), + + Tree(1, "tree"), + + Mesh(2, "mesh") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (FlowPattern enumItem : FlowPattern.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private FlowPattern(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding FlowPattern item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding FlowPattern item, or null if no such item exists + */ + public static FlowPattern forValue(int intValue) { + return VALUE_MAP.get(intValue); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/HealVnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/HealVnf.java new file mode 100644 index 0000000000000000000000000000000000000000..441fa9edb552d0b411680d7e62536c435d88b2b2 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/HealVnf.java @@ -0,0 +1,30 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This operation enables the NFVO to request a VNFM to perform a VNF healing + * procedure. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity heal-vnf {
+ *   base supported-operation;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/heal-vnf + * + */ +public interface HealVnf + extends + SupportedOperation +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("heal-vnf"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/InstantiateVnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/InstantiateVnf.java new file mode 100644 index 0000000000000000000000000000000000000000..c0a8ef19382385caa4aafd2bef4c0d5449070085 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/InstantiateVnf.java @@ -0,0 +1,30 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This operation instantiates a particular DF of a VNF based on the definition in + * the VNFD. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity instantiate-vnf {
+ *   base supported-operation;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/instantiate-vnf + * + */ +public interface InstantiateVnf + extends + SupportedOperation +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("instantiate-vnf"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/InternalLifecycleManagementScriptEvent.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/InternalLifecycleManagementScriptEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..1f5290e291229dafdb3cb146e3d9e0c04c61c6fb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/InternalLifecycleManagementScriptEvent.java @@ -0,0 +1,99 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.opendaylight.yangtools.yang.binding.Enumeration; + +public enum InternalLifecycleManagementScriptEvent implements Enumeration { + StartInstantiation(0, "start-instantiation"), + + EndInstantiation(1, "end-instantiation"), + + StartScaling(2, "start-scaling"), + + EndScaling(3, "end-scaling"), + + StartHealing(4, "start-healing"), + + EndHealing(5, "end-healing"), + + StartTermination(6, "start-termination"), + + EndTermination(7, "end-termination"), + + StartVnfFlavourChange(8, "start-vnf-flavour-change"), + + EndVnfFlavourChange(9, "end-vnf-flavour-change"), + + StartVnfOperationChange(10, "start-vnf-operation-change"), + + EndVnfOperationChange(11, "end-vnf-operation-change"), + + StartVnfExtConnChange(12, "start-vnf-ext-conn-change"), + + EndVnfExtConnChange(13, "end-vnf-ext-conn-change"), + + StartVnfinfoModification(14, "start-vnfinfo-modification"), + + EndVnfinfoModification(15, "end-vnfinfo-modification") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (InternalLifecycleManagementScriptEvent enumItem : InternalLifecycleManagementScriptEvent.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private InternalLifecycleManagementScriptEvent(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding InternalLifecycleManagementScriptEvent item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding InternalLifecycleManagementScriptEvent item, or null if no such item exists + */ + public static InternalLifecycleManagementScriptEvent forValue(int intValue) { + return VALUE_MAP.get(intValue); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/IpAddress.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/IpAddress.java new file mode 100644 index 0000000000000000000000000000000000000000..8ccb48668ef226d80e1226a1977ee8726102e196 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/IpAddress.java @@ -0,0 +1,28 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity ip-address {
+ *   base address-type;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/ip-address + * + */ +public interface IpAddress + extends + AddressType +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ip-address"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Ipv4.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Ipv4.java new file mode 100644 index 0000000000000000000000000000000000000000..d43c9d22793d462daf414389bb658bd369b0a8c8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Ipv4.java @@ -0,0 +1,28 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity ipv4 {
+ *   base layer-protocol;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/ipv4 + * + */ +public interface Ipv4 + extends + LayerProtocol +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ipv4"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Ipv6.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Ipv6.java new file mode 100644 index 0000000000000000000000000000000000000000..c6b337a178d4d7d02135807f8cb6da244f048b4d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Ipv6.java @@ -0,0 +1,28 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity ipv6 {
+ *   base layer-protocol;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/ipv6 + * + */ +public interface Ipv6 + extends + LayerProtocol +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ipv6"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/LayerProtocol.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/LayerProtocol.java new file mode 100644 index 0000000000000000000000000000000000000000..321aaf37049e978d5997cb022842d24d4dfe17e9 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/LayerProtocol.java @@ -0,0 +1,27 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.BaseIdentity; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity layer-protocol;
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/layer-protocol + * + */ +public interface LayerProtocol + extends + BaseIdentity +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("layer-protocol"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Leaf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Leaf.java new file mode 100644 index 0000000000000000000000000000000000000000..0a757cf6827e4aab6c4596d044f822bfc3e065dd --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Leaf.java @@ -0,0 +1,28 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity leaf {
+ *   base cp-role;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/leaf + * + */ +public interface Leaf + extends + CpRole +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("leaf"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/LinkBitrateRequirements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/LinkBitrateRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..8ddd79acdd8f2de3eb40ac9df4b13ad08eb05769 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/LinkBitrateRequirements.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping link-bitrate-requirements {
+ *   leaf root {
+ *     type uint64;
+ *     units Mbps;
+ *   }
+ *   leaf leaf {
+ *     type uint64;
+ *     units Mbps;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/link-bitrate-requirements + * + */ +public interface LinkBitrateRequirements + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("link-bitrate-requirements"); + + @Override + Class implementedInterface(); + + /** + * Specifies the throughput requirement of the link (e.g. bitrate of E-Line, root + * bitrate of E-Tree, aggregate capacity of E-LAN). + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 root, or null if not present + */ + @Nullable Uint64 getRoot(); + + /** + * Specifies the throughput requirement of leaf connections to the link when + * applicable to the connectivity type (e.g. for E-Tree and E-LAN branches). + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 leaf, or null if not present + */ + @Nullable Uint64 getLeaf(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/LocalAffinityOrAntiAffinityRule.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/LocalAffinityOrAntiAffinityRule.java new file mode 100644 index 0000000000000000000000000000000000000000..9008dee88e866c3c941f021bfc9e6b090443ed6e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/LocalAffinityOrAntiAffinityRule.java @@ -0,0 +1,57 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule.LocalAffinityOrAntiAffinityRuleKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping local-affinity-or-anti-affinity-rule {
+ *   list local-affinity-or-anti-affinity-rule {
+ *     key "affinity-type affinity-scope";
+ *     leaf affinity-type {
+ *       type affinity-type;
+ *     }
+ *     leaf affinity-scope {
+ *       type affinity-scope;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/local-affinity-or-anti-affinity-rule + * + */ +public interface LocalAffinityOrAntiAffinityRule + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("local-affinity-or-anti-affinity-rule"); + + @Override + Class implementedInterface(); + + /** + * @return java.util.Map localAffinityOrAntiAffinityRule, or null if not present + */ + @Nullable Map getLocalAffinityOrAntiAffinityRule(); + + /** + * @return java.util.Map localAffinityOrAntiAffinityRule, or an empty list if it is not present + */ + default @NonNull Map nonnullLocalAffinityOrAntiAffinityRule() { + return CodeHelpers.nonnull(getLocalAffinityOrAntiAffinityRule()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/MacAddress.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/MacAddress.java new file mode 100644 index 0000000000000000000000000000000000000000..66934107c86b1448cf5f14cc3e51491a6bcf98ab --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/MacAddress.java @@ -0,0 +1,28 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity mac-address {
+ *   base address-type;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/mac-address + * + */ +public interface MacAddress + extends + AddressType +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("mac-address"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ModifyVnfInformation.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ModifyVnfInformation.java new file mode 100644 index 0000000000000000000000000000000000000000..ba547a53bdd068da673918210fae65132b55a6cf --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ModifyVnfInformation.java @@ -0,0 +1,29 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This operation allows updating information about a VNF instance. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity modify-vnf-information {
+ *   base supported-operation;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/modify-vnf-information + * + */ +public interface ModifyVnfInformation + extends + SupportedOperation +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("modify-vnf-information"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/MonitoringParameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/MonitoringParameter.java new file mode 100644 index 0000000000000000000000000000000000000000..a5b39a1d46ba136992fb96a735b336c8ac79f498 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/MonitoringParameter.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping monitoring-parameter {
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf performance-metric {
+ *     type string;
+ *   }
+ *   leaf collection-period {
+ *     type uint64;
+ *     units ms;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/monitoring-parameter + * + */ +public interface MonitoringParameter + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("monitoring-parameter"); + + @Override + Class implementedInterface(); + + /** + * Human readable name of the monitoring parameter. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Performance metric that is monitored. This attribute shall contain the related + * 'Measurement Name' value as defined in clause 7.2 of ETSI GS NFV-IFA 027 + * + * + * + * @return java.lang.String performanceMetric, or null if not present + */ + @Nullable String getPerformanceMetric(); + + /** + * An attribute that describes the recommended periodicity at which to collect the + * performance information. VNFM determines if this parameter is considered. The + * vendor may provide this information as a guidance for creating PmJobs if needed. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 collectionPeriod, or null if not present + */ + @Nullable Uint64 getCollectionPeriod(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Mpls.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Mpls.java new file mode 100644 index 0000000000000000000000000000000000000000..bfdeb636981615bddd4a6ec62b9122c24abdcf6c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Mpls.java @@ -0,0 +1,28 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity mpls {
+ *   base layer-protocol;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/mpls + * + */ +public interface Mpls + extends + LayerProtocol +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("mpls"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Nfv.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Nfv.java new file mode 100644 index 0000000000000000000000000000000000000000..5b0214dc02e502d821f26a20e328295431c62f3e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Nfv.java @@ -0,0 +1,112 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.Nsd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.NsdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.Pnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.PnfdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.VnfdKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container nfv {
+ *   list vnfd {
+ *     key id;
+ *     uses vnfd;
+ *   }
+ *   list nsd {
+ *     key id;
+ *     uses nsd;
+ *   }
+ *   list pnfd {
+ *     key id;
+ *     uses pnfd;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nfv + * + *

To create instances of this class use {@link NfvBuilder}. + * @see NfvBuilder + * + */ +public interface Nfv + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("nfv"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nfv.class; + } + + /** + * A VNF Descriptor (VNFD) is a deployment template which describes a VNF in terms + * of deployment and operational behaviour requirements. It also contains + * connectivity, interface and virtualised resource requirements + * + * + * + * @return java.util.Map vnfd, or null if not present + */ + @Nullable Map getVnfd(); + + /** + * @return java.util.Map vnfd, or an empty list if it is not present + */ + default @NonNull Map nonnullVnfd() { + return CodeHelpers.nonnull(getVnfd()); + } + + /** + * The NSD information element is a deployment template whose instances are used by + * the NFVO for the lifecycle management of NSs. + * + * + * + * @return java.util.Map nsd, or null if not present + */ + @Nullable Map getNsd(); + + /** + * @return java.util.Map nsd, or an empty list if it is not present + */ + default @NonNull Map nonnullNsd() { + return CodeHelpers.nonnull(getNsd()); + } + + /** + * The Pnfd information element is a deployment template enabling on-boarding PNFs + * and referencing them from an NSD. It focuses on connectivity aspects only. + * + * + * + * @return java.util.Map pnfd, or null if not present + */ + @Nullable Map getPnfd(); + + /** + * @return java.util.Map pnfd, or an empty list if it is not present + */ + default @NonNull Map nonnullPnfd() { + return CodeHelpers.nonnull(getPnfd()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/NfvBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/NfvBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..81f9e2d69cbfea3b9c4f25899c5747b605a77a0d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/NfvBuilder.java @@ -0,0 +1,331 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.Nsd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.NsdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.Pnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.PnfdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.VnfdKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NfvBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NfvBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NfvBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NfvBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NfvBuilder + * @see Builder + * + */ +public class NfvBuilder implements Builder { + + private Map _nsd; + private Map _pnfd; + private Map _vnfd; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NfvBuilder() { + } + + public NfvBuilder(Nfv base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._nsd = base.getNsd(); + this._pnfd = base.getPnfd(); + this._vnfd = base.getVnfd(); + } + + + public Map getNsd() { + return _nsd; + } + + public Map getPnfd() { + return _pnfd; + } + + public Map getVnfd() { + return _vnfd; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public NfvBuilder setNsd(final Map values) { + this._nsd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setNsd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NfvBuilder setNsd(final List values) { + return setNsd(CodeHelpers.compatMap(values)); + } + public NfvBuilder setPnfd(final Map values) { + this._pnfd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setPnfd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NfvBuilder setPnfd(final List values) { + return setPnfd(CodeHelpers.compatMap(values)); + } + public NfvBuilder setVnfd(final Map values) { + this._vnfd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVnfd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NfvBuilder setVnfd(final List values) { + return setVnfd(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NfvBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NfvBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NfvBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NfvBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Nfv build() { + return new NfvImpl(this); + } + + private static final class NfvImpl + extends AbstractAugmentable + implements Nfv { + + private final Map _nsd; + private final Map _pnfd; + private final Map _vnfd; + + NfvImpl(NfvBuilder base) { + super(base.augmentation); + this._nsd = CodeHelpers.emptyToNull(base.getNsd()); + this._pnfd = CodeHelpers.emptyToNull(base.getPnfd()); + this._vnfd = CodeHelpers.emptyToNull(base.getVnfd()); + } + + @Override + public Map getNsd() { + return _nsd; + } + + @Override + public Map getPnfd() { + return _pnfd; + } + + @Override + public Map getVnfd() { + return _vnfd; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_nsd); + result = prime * result + Objects.hashCode(_pnfd); + result = prime * result + Objects.hashCode(_vnfd); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Nfv.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Nfv other = (Nfv)obj; + if (!Objects.equals(_nsd, other.getNsd())) { + return false; + } + if (!Objects.equals(_pnfd, other.getPnfd())) { + return false; + } + if (!Objects.equals(_vnfd, other.getVnfd())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NfvImpl otherImpl = (NfvImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Nfv"); + CodeHelpers.appendValue(helper, "_nsd", _nsd); + CodeHelpers.appendValue(helper, "_pnfd", _pnfd); + CodeHelpers.appendValue(helper, "_vnfd", _vnfd); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Nsd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Nsd.java new file mode 100644 index 0000000000000000000000000000000000000000..1e808376dc18aa3a1e40f3bde049f6d13cafd2d7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Nsd.java @@ -0,0 +1,867 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.NsdBuilder.NsdImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.VnfdBuilder.VnfdImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.DfKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.LifecycleManagementScript; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.LifecycleManagementScriptKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Sapd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.SapdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VirtualLinkDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VirtualLinkDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Vnffgd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VnffgdKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping nsd {
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf designer {
+ *     type string;
+ *   }
+ *   leaf version {
+ *     type string;
+ *   }
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf invariant-id {
+ *     type string;
+ *   }
+ *   leaf-list nested-nsd-id {
+ *     must ". != ../id";
+ *     type leafref {
+ *       path ../../nsd/id;
+ *     }
+ *   }
+ *   leaf-list vnfd-id {
+ *     type leafref {
+ *       path ../../vnfd/id;
+ *     }
+ *   }
+ *   leaf-list pnfd-id {
+ *     type leafref {
+ *       path ../../pnfd/id;
+ *     }
+ *   }
+ *   list sapd {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf address-assignment {
+ *       type boolean;
+ *     }
+ *     choice cpd-or-virtual-link {
+ *       case virtual-link-desc {
+ *         leaf virtual-link-desc {
+ *           type leafref {
+ *             path ../../virtual-link-desc/id;
+ *           }
+ *         }
+ *       }
+ *       case vnf {
+ *         container vnf {
+ *           leaf vnfd-id {
+ *             type leafref {
+ *               path ../../../../vnfd/id;
+ *             }
+ *             must boolean(../../../vnfd-id[.=current()]);
+ *           }
+ *           leaf ext-cpd-id {
+ *             type leafref {
+ *               path deref(../vnfd-id)/../ext-cpd/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *       case pnf {
+ *         container pnf {
+ *           leaf pnfd-id {
+ *             type leafref {
+ *               path ../../../../pnfd/id;
+ *             }
+ *             must boolean(../pnfd-id[.=current()]);
+ *           }
+ *           leaf ext-cpd-id {
+ *             type leafref {
+ *               path deref(../pnfd-id)/../ext-cpd/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *       case ns {
+ *         container ns {
+ *           leaf nsd-id {
+ *             type leafref {
+ *               path ../../../../nsd/id;
+ *             }
+ *             must boolean(../nsd-id[.=current()]);
+ *           }
+ *           leaf ext-cpd-id {
+ *             type leafref {
+ *               path deref(../nsd-id)/../sapd/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ *   list virtual-link-desc {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     uses connectivity-type;
+ *     list df {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       container qos {
+ *         presence "VL QoS parameters";
+ *         leaf latency {
+ *           type uint32;
+ *           units ms;
+ *         }
+ *         leaf packet-delay-variation {
+ *           type uint32;
+ *           units ms;
+ *         }
+ *         leaf packet-loss-ratio {
+ *           type decimal64 {
+ *             fraction-digits 2;
+ *             range 0..1.00;
+ *           }
+ *         }
+ *         leaf priority {
+ *           type uint32;
+ *         }
+ *       }
+ *       leaf service-availability-level {
+ *         type enumeration {
+ *           enum level-1;
+ *           enum level-2;
+ *           enum level-3;
+ *         }
+ *       }
+ *     }
+ *     leaf test-access {
+ *       type enumeration {
+ *         enum none;
+ *         enum passive-monitoring;
+ *         enum active;
+ *       }
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     uses security-parameters;
+ *   }
+ *   list vnffgd {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf-list vnf-profile-id {
+ *       type leafref {
+ *         path ../../df/vnf-profile/id;
+ *       }
+ *     }
+ *     leaf-list pnf-profile-id {
+ *       type leafref {
+ *         path ../../df/pnf-profile/id;
+ *       }
+ *     }
+ *     leaf-list nested-ns-profile-id {
+ *       type leafref {
+ *         path ../../df/ns-profile/id;
+ *       }
+ *     }
+ *     leaf virtual-link-profile-id {
+ *       type leafref {
+ *         path ../../df/virtual-link-profile/id;
+ *       }
+ *     }
+ *     list cpd-pool {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       choice constituent-base-element-id {
+ *         case vnf-profile {
+ *           container vnf-profile {
+ *             leaf vnf-profile-id {
+ *               type leafref {
+ *                 path ../../../../../nsd/df/vnf-profile/id;
+ *               }
+ *             }
+ *           }
+ *         }
+ *         case pnf-profile {
+ *           container pnf-profile {
+ *             leaf pnf-profile-id {
+ *               type leafref {
+ *                 path ../../../../../nsd/df/pnf-profile/id;
+ *               }
+ *             }
+ *           }
+ *         }
+ *         case ns-profile {
+ *           container ns-profile {
+ *             leaf ns-profile-id {
+ *               type leafref {
+ *                 path ../../../../../nsd/df/ns-profile/id;
+ *               }
+ *             }
+ *           }
+ *         }
+ *       }
+ *       choice constituent-cpd-id {
+ *         case vnf {
+ *           container vnf {
+ *             leaf vnfd-id {
+ *               type leafref {
+ *                 path ../../../../../vnfd/id;
+ *               }
+ *             }
+ *             leaf cpd-id {
+ *               type leafref {
+ *                 path deref(../vnfd-id)/../ext-cpd/id;
+ *               }
+ *             }
+ *           }
+ *         }
+ *         case pnf {
+ *           container pnf {
+ *             leaf pnfd-id {
+ *               type leafref {
+ *                 path ../../../../../pnfd/id;
+ *               }
+ *             }
+ *             leaf pnf-cpd-id {
+ *               type leafref {
+ *                 path deref(../pnfd-id)/../ext-cpd/id;
+ *               }
+ *             }
+ *           }
+ *         }
+ *         case ns {
+ *           container ns {
+ *             leaf nsd-id {
+ *               type leafref {
+ *                 path ../../../../../nsd/id;
+ *               }
+ *             }
+ *             leaf sap-cpd-id {
+ *               type leafref {
+ *                 path deref(../nsd-id)/../sapd/id;
+ *               }
+ *             }
+ *           }
+ *         }
+ *       }
+ *     }
+ *     list nfpd {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf rule {
+ *         type string;
+ *       }
+ *       list position-desc-id {
+ *         key id;
+ *         leaf id {
+ *           type string;
+ *         }
+ *         list cp-profile-id {
+ *           key id;
+ *           leaf id {
+ *             type string;
+ *           }
+ *           list constituent-profile-elements {
+ *             key id;
+ *             leaf id {
+ *               type string;
+ *             }
+ *             leaf cpd-id {
+ *               type string;
+ *             }
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ *   leaf-list autoscale-rule {
+ *     type string;
+ *   }
+ *   list lifecycle-management-script {
+ *     key event;
+ *     leaf event {
+ *       type string;
+ *     }
+ *     leaf script {
+ *       type string;
+ *     }
+ *   }
+ *   list df {
+ *     min-elements 1;
+ *     must "default-instantiation-level or count(ns-instantiation-level) = 1" {
+ *       error-message
+ *         "default-instantiation-level must be present if there multiple instantion-level";
+ *     }
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf flavour-key {
+ *       type leafref {
+ *         path ../monitored-info/id;
+ *       }
+ *     }
+ *     list vnf-profile {
+ *       must "min-number-of-instances <= max-number-of-instances";
+ *       must boolean(../../vnfd-id[.=current()/vnfd-id]) {
+ *         error-message
+ *           "VNFDs in the profile has to be listed as a dependency of the network service descriptor.";
+ *       }
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf vnfd-id {
+ *         type leafref {
+ *           path ../../../../vnfd/id;
+ *         }
+ *       }
+ *       leaf flavour-id {
+ *         type leafref {
+ *           path deref(../vnfd-id)/../df/id;
+ *         }
+ *       }
+ *       leaf instantiation-level {
+ *         type leafref {
+ *           path deref(../flavour-id)/../instantiation-level/id;
+ *         }
+ *       }
+ *       leaf min-number-of-instances {
+ *         default 1;
+ *         type uint16;
+ *       }
+ *       leaf max-number-of-instances {
+ *         default 1;
+ *         type uint16;
+ *       }
+ *       uses local-affinity-or-anti-affinity-rule;
+ *       list affinity-or-anti-affinity-group {
+ *         key id;
+ *         leaf id {
+ *           type leafref {
+ *             path ../../../affinity-or-anti-affinity-group/id;
+ *           }
+ *         }
+ *       }
+ *       list virtual-link-connectivity {
+ *         key virtual-link-profile-id;
+ *         leaf virtual-link-profile-id {
+ *           type leafref {
+ *             path ../../../virtual-link-profile/id;
+ *           }
+ *         }
+ *         list constituent-cpd-id {
+ *           key constituent-base-element-id;
+ *           leaf constituent-base-element-id {
+ *             type leafref {
+ *               path ../../../id;
+ *             }
+ *           }
+ *           leaf constituent-cpd-id {
+ *             type leafref {
+ *               path deref(../../../vnfd-id)/../ext-cpd/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *     }
+ *     list pnf-profile {
+ *       key id;
+ *       must boolean(../../pnfd-id[.=current()/pnfd-id]) {
+ *         error-message
+ *           "PNFDs in the profile has to be listed as a dependency of the network service descriptor.";
+ *       }
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf pnfd-id {
+ *         type leafref {
+ *           path ../../../../pnfd/id;
+ *         }
+ *       }
+ *       list virtual-link-connectivity {
+ *         key virtual-link-profile-id;
+ *         leaf virtual-link-profile-id {
+ *           type leafref {
+ *             path ../../../virtual-link-profile/id;
+ *           }
+ *         }
+ *         list constituent-cpd-id {
+ *           key constituent-base-element-id;
+ *           leaf constituent-base-element-id {
+ *             type leafref {
+ *               path ../../../id;
+ *             }
+ *           }
+ *           leaf constituent-cpd-id {
+ *             type leafref {
+ *               path deref(../../../pnfd-id)/../ext-cpd/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *     }
+ *     list virtual-link-profile {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf virtual-link-desc-id {
+ *         type leafref {
+ *           path ../../../virtual-link-desc/id;
+ *         }
+ *       }
+ *       leaf flavour-id {
+ *         type leafref {
+ *           path deref(../virtual-link-desc-id)/../df/id;
+ *         }
+ *       }
+ *       uses local-affinity-or-anti-affinity-rule;
+ *       list affinity-or-anti-affinity-group {
+ *         key id;
+ *         leaf id {
+ *           type leafref {
+ *             path ../../../affinity-or-anti-affinity-group/id;
+ *           }
+ *         }
+ *       }
+ *       container max-bitrate-requirements {
+ *         uses link-bitrate-requirements;
+ *       }
+ *       container min-bitrate-requirements {
+ *         uses link-bitrate-requirements;
+ *       }
+ *     }
+ *     list scaling-aspect {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf name {
+ *         type string;
+ *       }
+ *       leaf description {
+ *         type string;
+ *       }
+ *       leaf scaling-level {
+ *         type leafref {
+ *           path ../../ns-instantiation-level/id;
+ *         }
+ *       }
+ *     }
+ *     list affinity-or-anti-affinity-group {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf type {
+ *         type affinity-type;
+ *       }
+ *       leaf scope {
+ *         type affinity-scope;
+ *       }
+ *     }
+ *     list ns-instantiation-level {
+ *       min-elements 1;
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf description {
+ *         type string;
+ *       }
+ *       list vnf-to-level-mapping {
+ *         key vnf-profile-id;
+ *         leaf vnf-profile-id {
+ *           type leafref {
+ *             path ../../../vnf-profile/id;
+ *           }
+ *         }
+ *         leaf number-of-instances {
+ *           default 1;
+ *           type uint32;
+ *         }
+ *       }
+ *       list virtual-link-to-level-mapping {
+ *         key virtual-link-profile-id;
+ *         leaf virtual-link-profile-id {
+ *           type leafref {
+ *             path ../../../virtual-link-profile/id;
+ *           }
+ *         }
+ *         uses link-bitrate-requirements;
+ *       }
+ *       list ns-to-level-mapping {
+ *         key ns-profile-id;
+ *         leaf ns-profile-id {
+ *           type leafref {
+ *             path ../../../ns-profile/id;
+ *           }
+ *         }
+ *         leaf number-of-instances {
+ *           default 1;
+ *           type uint32;
+ *         }
+ *       }
+ *       must "(count(vnf-to-level-mapping) + count(virtual-link-to-level-mapping) + count(ns-to-level-mapping)) > 0" {
+ *         error-message
+ *           "At least one attribute between vnf-to-level-mapping, virtual-link-to-level-mapping and ns-to-level-mapping shall be present.";
+ *       }
+ *     }
+ *     leaf default-instantiation-level {
+ *       type leafref {
+ *         path ../ns-instantiation-level/id;
+ *       }
+ *     }
+ *     list ns-profile {
+ *       must "min-number-of-instances <= max-number-of-instances" {
+ *         error-message
+ *           "min-number-of-instances has to be less than or equalmax-number-of-instances.";
+ *       }
+ *       must boolean(../../nested-nsd-id[.=current()/nsd-id]) {
+ *         error-message
+ *           "PNFDs in the profile has to be listed as a dependency of the network service descriptor.";
+ *       }
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf nsd-id {
+ *         type leafref {
+ *           path ../../../../nsd/id;
+ *         }
+ *       }
+ *       leaf ns-df-id {
+ *         type leafref {
+ *           path deref(../nsd-id)/../df/id;
+ *         }
+ *       }
+ *       leaf instantiation-level-id {
+ *         type leafref {
+ *           path deref(../ns-df-id)/../ns-instantiation-level/id;
+ *         }
+ *       }
+ *       leaf min-number-of-instances {
+ *         type uint16;
+ *         default 1;
+ *       }
+ *       leaf max-number-of-instances {
+ *         type uint16;
+ *         default 1;
+ *       }
+ *       list affinity-or-anti-affinity-group-id {
+ *         key id;
+ *         leaf id {
+ *           type leafref {
+ *             path ../../../affinity-or-anti-affinity-group/id;
+ *           }
+ *         }
+ *       }
+ *       list virtual-link-connectivity {
+ *         key virtual-link-profile-id;
+ *         leaf virtual-link-profile-id {
+ *           type leafref {
+ *             path ../../../virtual-link-profile/id;
+ *           }
+ *         }
+ *         list constituent-cpd-id {
+ *           key constituent-base-element-id;
+ *           leaf constituent-base-element-id {
+ *             type leafref {
+ *               path ../../../id;
+ *             }
+ *           }
+ *           leaf constituent-cpd-id {
+ *             type leafref {
+ *               path deref(../../../nsd-id)/../sapd/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *     }
+ *     list dependencies {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       choice primary-id {
+ *         case primary-vnf-profile {
+ *           leaf primary-vnf-profile {
+ *             type leafref {
+ *               path ../../vnf-profile/vnfd-id;
+ *             }
+ *           }
+ *         }
+ *         case primary-ns-profile {
+ *           leaf primary-ns-profile {
+ *             type leafref {
+ *               path ../../ns-profile/nsd-id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *       choice secondary-id {
+ *         case secondary-vnf-profile {
+ *           leaf secondary-vnf-profile {
+ *             type leafref {
+ *               path ../../vnf-profile/vnfd-id;
+ *             }
+ *           }
+ *         }
+ *         case secondary-ns-profile {
+ *           leaf secondary-ns-profile {
+ *             type leafref {
+ *               path ../../ns-profile/nsd-id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *     }
+ *     list monitored-info {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       container vnf-indicator-info {
+ *         leaf vnfd-id {
+ *           type leafref {
+ *             path ../../../../../vnfd/id;
+ *           }
+ *         }
+ *         leaf vnf-indicator {
+ *           type leafref {
+ *             path deref(../vnfd-id)/../indicator/id;
+ *           }
+ *         }
+ *       }
+ *       container monitoring-parameter {
+ *         leaf id {
+ *           type string;
+ *         }
+ *         leaf name {
+ *           type string;
+ *         }
+ *         leaf performance-metric {
+ *           type string;
+ *         }
+ *         leaf collection-period {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   uses security-parameters;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd + * + */ +@JsonDeserialize(as = NsdImpl.class) +@JsonIgnoreProperties(value= {"virtualStorageDesc","extCpd","securityGroupRule","indicator","swImageDesc"}, ignoreUnknown = true) +public interface Nsd + extends + DataObject, + SecurityParameters +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("nsd"); + + @Override + Class implementedInterface(); + + /** + * Identifier of this NSD information element. It Globally uniquely identifies an + * instance of the NSD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Identifies the designer of the NSD. + * + * + * + * @return java.lang.String designer, or null if not present + */ + @Nullable String getDesigner(); + + /** + * Identifies the version of the NSD. + * + * + * + * @return java.lang.String version, or null if not present + */ + @Nullable String getVersion(); + + /** + * Provides the human readable name of the NSD. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Identifies an NSD in a version independent manner. This attribute is invariant + * across versions of the network service descriptor. + * + * + * + * @return java.lang.String invariantId, or null if not present + */ + @Nullable String getInvariantId(); + + /** + * References the NSD of a constituent nested NS. + * + * + * + * @return java.util.List nestedNsdId, or null if not present + */ + @Nullable List getNestedNsdId(); + + /** + * References the VNFD of a constituent VNF. + * + * + * + * @return java.util.List vnfdId, or null if not present + */ + @Nullable List getVnfdId(); + + /** + * References the PNFD of a constituent PNF. + * + * + * + * @return java.util.List pnfdId, or null if not present + */ + @Nullable List getPnfdId(); + + /** + * Provides the descriptor of a service access point of the network service. + * + * + * + * @return java.util.Map sapd, or null if not present + */ + @Nullable Map getSapd(); + + /** + * @return java.util.Map sapd, or an empty list if it is not present + */ + default @NonNull Map nonnullSapd() { + return CodeHelpers.nonnull(getSapd()); + } + + /** + * Provides the constituent VLDs. + * + * + * + * @return java.util.Map virtualLinkDesc, or null if not present + */ + @Nullable Map getVirtualLinkDesc(); + + /** + * @return java.util.Map virtualLinkDesc, or an empty list if it is not present + */ + default @NonNull Map nonnullVirtualLinkDesc() { + return CodeHelpers.nonnull(getVirtualLinkDesc()); + } + + /** + * Provides the descriptors of the applicable forwarding graphs. + * + * + * + * @return java.util.Map vnffgd, or null if not present + */ + @Nullable Map getVnffgd(); + + /** + * @return java.util.Map vnffgd, or an empty list if it is not present + */ + default @NonNull Map nonnullVnffgd() { + return CodeHelpers.nonnull(getVnffgd()); + } + + /** + * @return java.util.List autoscaleRule, or null if not present + */ + @Nullable List getAutoscaleRule(); + + /** + * @return java.util.Map lifecycleManagementScript, or null if not present + */ + @Nullable Map getLifecycleManagementScript(); + + /** + * @return java.util.Map lifecycleManagementScript, or an empty list if it is not present + */ + default @NonNull Map nonnullLifecycleManagementScript() { + return CodeHelpers.nonnull(getLifecycleManagementScript()); + } + + /** + * Identifies a DF within the scope of an NSD. + * + * + * + * @return java.util.Map df, or null if not present + */ + @Nullable Map getDf(); + + /** + * @return java.util.Map df, or an empty list if it is not present + */ + default @NonNull Map nonnullDf() { + return CodeHelpers.nonnull(getDf()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Odu2.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Odu2.java new file mode 100644 index 0000000000000000000000000000000000000000..c1b8c17002d82f35e8c48548c18b707571973c94 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Odu2.java @@ -0,0 +1,28 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity odu2 {
+ *   base layer-protocol;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/odu2 + * + */ +public interface Odu2 + extends + LayerProtocol +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("odu2"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/OperateVnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/OperateVnf.java new file mode 100644 index 0000000000000000000000000000000000000000..f3f7b5fe5bc52c6439805c12844dcc61d1c582d5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/OperateVnf.java @@ -0,0 +1,30 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This operation enables requesting to change the state of a VNF instance, + * including starting and stopping the VNF instance. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity operate-vnf {
+ *   base supported-operation;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/operate-vnf + * + */ +public interface OperateVnf + extends + SupportedOperation +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("operate-vnf"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Pnfd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Pnfd.java new file mode 100644 index 0000000000000000000000000000000000000000..adb94602df9bb842da60d973da2db587827ad871 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Pnfd.java @@ -0,0 +1,175 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.ExtCpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.ExtCpdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.Security; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.SecurityKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The Pnfd information element is a deployment template enabling on-boarding PNFs + * and referencing them from an NSD. It focuses on connectivity aspects only + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping pnfd {
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf function-description {
+ *     type string;
+ *   }
+ *   leaf provider {
+ *     type string;
+ *   }
+ *   leaf version {
+ *     type string;
+ *   }
+ *   leaf invariant-id {
+ *     type string;
+ *   }
+ *   leaf name {
+ *     type string;
+ *   }
+ *   list ext-cpd {
+ *     key id;
+ *     uses cpd;
+ *   }
+ *   list security {
+ *     key signature;
+ *     uses security-parameters;
+ *   }
+ *   leaf geographical-location-info {
+ *     type string;
+ *   }
+ *   uses security-group-rule;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/pnfd + * + */ +public interface Pnfd + extends + DataObject, + SecurityGroupRule +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pnfd"); + + @Override + Class implementedInterface(); + + /** + * Identifier of this Pnfd information element. It uniquely identifies the PNFD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Describes the PNF function. + * + * + * + * @return java.lang.String functionDescription, or null if not present + */ + @Nullable String getFunctionDescription(); + + /** + * Identifies the provider of the PNFD. + * + * + * + * @return java.lang.String provider, or null if not present + */ + @Nullable String getProvider(); + + /** + * Identifies the version of the PNFD. + * + * + * + * @return java.lang.String version, or null if not present + */ + @Nullable String getVersion(); + + /** + * Identifies a PNFD in a version independent manner. This attribute is invariant + * across versions of PNFD. + * + * + * + * @return java.lang.String invariantId, or null if not present + */ + @Nullable String getInvariantId(); + + /** + * Provides the human readable name of the PNFD. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Specifies the characteristics of one or more connection points where to connect + * the PNF to a VL. + * + * + * + * @return java.util.Map extCpd, or null if not present + */ + @Nullable Map getExtCpd(); + + /** + * @return java.util.Map extCpd, or an empty list if it is not present + */ + default @NonNull Map nonnullExtCpd() { + return CodeHelpers.nonnull(getExtCpd()); + } + + /** + * Provides a signature to prevent tampering. Editor's Note: While IFA014 does + * specify that the PNFD includes a security parameter. SOL001 does not have one. + * We need to harmonize SOL001 & SOL006 on this point. + * + * + * + * @return java.util.Map security, or null if not present + */ + @Nullable Map getSecurity(); + + /** + * @return java.util.Map security, or an empty list if it is not present + */ + default @NonNull Map nonnullSecurity() { + return CodeHelpers.nonnull(getSecurity()); + } + + /** + * It provides information about the geographical location (e.g. geographic + * coordinates or address of the building, etc.) of the PNF. The cardinality 0 is + * used when the location is unknown. Editor's Note: The type is TBD in SOL001. We + * need to make a common SOL001/SOL006 decision. + * + * + * + * @return java.lang.String geographicalLocationInfo, or null if not present + */ + @Nullable String getGeographicalLocationInfo(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/PseudoWire.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/PseudoWire.java new file mode 100644 index 0000000000000000000000000000000000000000..cf1adcc3489e73ecf1774de8005564ee6698e88f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/PseudoWire.java @@ -0,0 +1,28 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity pseudo-wire {
+ *   base layer-protocol;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/pseudo-wire + * + */ +public interface PseudoWire + extends + LayerProtocol +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pseudo-wire"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/QueryVnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/QueryVnf.java new file mode 100644 index 0000000000000000000000000000000000000000..2906f3ebf914c0250ea82bd11ef5b1c6f7f6eee9 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/QueryVnf.java @@ -0,0 +1,31 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This operation provides information about VNF instances. The applicable VNF + * instances can be chosen based on filtering criteria, and the information can be + * restricted to selected attributes. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity query-vnf {
+ *   base supported-operation;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/query-vnf + * + */ +public interface QueryVnf + extends + SupportedOperation +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("query-vnf"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ResourceHandle.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ResourceHandle.java new file mode 100644 index 0000000000000000000000000000000000000000..41738be15b6cd65e8ccc3d42adc4abf68164229e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ResourceHandle.java @@ -0,0 +1,58 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping resource-handle {
+ *   leaf vim-id {
+ *     type string;
+ *   }
+ *   leaf resource-provider-id {
+ *     type string;
+ *   }
+ *   leaf resource-id {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/resource-handle + * + */ +public interface ResourceHandle + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("resource-handle"); + + @Override + Class implementedInterface(); + + /** + * @return java.lang.String vimId, or null if not present + */ + @Nullable String getVimId(); + + /** + * @return java.lang.String resourceProviderId, or null if not present + */ + @Nullable String getResourceProviderId(); + + /** + * @return java.lang.String resourceId, or null if not present + */ + @Nullable String getResourceId(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Root.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Root.java new file mode 100644 index 0000000000000000000000000000000000000000..c71ed85ef49246a6668935e55e87845e95e45fa0 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Root.java @@ -0,0 +1,28 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity root {
+ *   base cp-role;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/root + * + */ +public interface Root + extends + CpRole +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("root"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/RootStorage.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/RootStorage.java new file mode 100644 index 0000000000000000000000000000000000000000..4de09bcdef7937e819b9e403885ab4481f63d911 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/RootStorage.java @@ -0,0 +1,29 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Root type of storage. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity root-storage {
+ *   base storage-type;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/root-storage + * + */ +public interface RootStorage + extends + StorageType +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("root-storage"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ScaleVnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ScaleVnf.java new file mode 100644 index 0000000000000000000000000000000000000000..7ad35e4444c9d878ab049a873260fe61fcc695f4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ScaleVnf.java @@ -0,0 +1,32 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This operation provides methods to request scaling a VNF in multiple ways: • + * horizontal scaling: - scale out: adding additional VNFC instances to the VNF to + * increase capacity - scale in: removing VNFC instances from the VNF, in order to + * release unused capacity + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity scale-vnf {
+ *   base supported-operation;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/scale-vnf + * + */ +public interface ScaleVnf + extends + SupportedOperation +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("scale-vnf"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ScaleVnfToLevel.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ScaleVnfToLevel.java new file mode 100644 index 0000000000000000000000000000000000000000..ba34b21cd7b5391a2fe1f99755834fdf6ebbfa14 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/ScaleVnfToLevel.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This operation scales an instantiated VNF of a particular DF to a target size. + * The target size is either expressed as an instantiation level of that DF as + * defined in the VNFD, or given as a list of scale levels, one per scaling aspect + * of that DF. Instantiation levels and scaling aspects are declared in the VNFD. + * Typically, the result of this operation is adding and/or removing Network + * Functions Virtualization Infrastructure (NFVI) resources to/from the VNF. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity scale-vnf-to-level {
+ *   base supported-operation;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/scale-vnf-to-level + * + */ +public interface ScaleVnfToLevel + extends + SupportedOperation +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("scale-vnf-to-level"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SecurityGroupRule.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SecurityGroupRule.java new file mode 100644 index 0000000000000000000000000000000000000000..032472d17cd22c7309af99fbde916d1190f68362 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SecurityGroupRule.java @@ -0,0 +1,93 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRuleKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping security-group-rule {
+ *   list security-group-rule {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     leaf direction {
+ *       type enumeration {
+ *         enum ingress;
+ *         enum egress;
+ *       }
+ *       default ingress;
+ *     }
+ *     leaf ether-type {
+ *       type enumeration {
+ *         enum ipv4;
+ *         enum ipv6;
+ *       }
+ *       default ipv4;
+ *     }
+ *     leaf protocol {
+ *       type enumeration {
+ *         enum tcp;
+ *         enum udp;
+ *         enum icmp;
+ *       }
+ *       default tcp;
+ *     }
+ *     leaf port-range-min {
+ *       must ". <= ../port-range-max";
+ *       type uint16;
+ *       default 0;
+ *     }
+ *     leaf port-range-max {
+ *       must ". >= ../port-range-min";
+ *       type uint16;
+ *       default 65535;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/security-group-rule + * + */ +public interface SecurityGroupRule + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("security-group-rule"); + + @Override + Class implementedInterface(); + + /** + * Defines security group rules to be used by the VNF. + * + * + * + * @return java.util.Map securityGroupRule, or null if not present + */ + @Nullable Map getSecurityGroupRule(); + + /** + * @return java.util.Map securityGroupRule, or an empty list if it is not present + */ + default @NonNull Map nonnullSecurityGroupRule() { + return CodeHelpers.nonnull(getSecurityGroupRule()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SecurityParameters.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SecurityParameters.java new file mode 100644 index 0000000000000000000000000000000000000000..eb41f0b0fd01d28efdfe3e6b1b4459c1c87836b5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SecurityParameters.java @@ -0,0 +1,71 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping security-parameters {
+ *   leaf signature {
+ *     type string;
+ *   }
+ *   leaf algorithm {
+ *     type string;
+ *   }
+ *   leaf certificate {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/security-parameters + * + */ +public interface SecurityParameters + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("security-parameters"); + + @Override + Class implementedInterface(); + + /** + * Provides the signature of the signed part of the descriptor. + * + * + * + * @return java.lang.String signature, or null if not present + */ + @Nullable String getSignature(); + + /** + * Identifies the algorithm used to compute the signature. + * + * + * + * @return java.lang.String algorithm, or null if not present + */ + @Nullable String getAlgorithm(); + + /** + * Provides a certificate or a reference to a certificate to validate the + * signature. + * + * + * + * @return java.lang.String certificate, or null if not present + */ + @Nullable String getCertificate(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha224.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha224.java new file mode 100644 index 0000000000000000000000000000000000000000..772f35253f70f5ef4878de5b8f7ffa1de7f6a59d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha224.java @@ -0,0 +1,29 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * SHA-224. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity sha-224 {
+ *   base checksum-algorithm;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/sha-224 + * + */ +public interface Sha224 + extends + ChecksumAlgorithm +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("sha-224"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha256.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha256.java new file mode 100644 index 0000000000000000000000000000000000000000..4448189636aa23a60ff2c30d9335c75fc69c7a94 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha256.java @@ -0,0 +1,29 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * SHA-256. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity sha-256 {
+ *   base checksum-algorithm;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/sha-256 + * + */ +public interface Sha256 + extends + ChecksumAlgorithm +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("sha-256"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha384.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha384.java new file mode 100644 index 0000000000000000000000000000000000000000..b23be7adca21f05d33471cfa5795509797f42d1a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha384.java @@ -0,0 +1,29 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * SHA-384. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity sha-384 {
+ *   base checksum-algorithm;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/sha-384 + * + */ +public interface Sha384 + extends + ChecksumAlgorithm +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("sha-384"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha512.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha512.java new file mode 100644 index 0000000000000000000000000000000000000000..d467b05ac50d355709843360c09c50c24aba57b0 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Sha512.java @@ -0,0 +1,29 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * SHA-512. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity sha-512 {
+ *   base checksum-algorithm;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/sha-512 + * + */ +public interface Sha512 + extends + ChecksumAlgorithm +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("sha-512"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/StorageType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/StorageType.java new file mode 100644 index 0000000000000000000000000000000000000000..84f87240511c3ff03fe192110c31cf80d37ee51c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/StorageType.java @@ -0,0 +1,29 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.BaseIdentity; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Base type of storage that identities can derive from. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity storage-type {
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/storage-type + * + */ +public interface StorageType + extends + BaseIdentity +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("storage-type"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SupportedOperation.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SupportedOperation.java new file mode 100644 index 0000000000000000000000000000000000000000..47bdf88e3485069dae0d46fc227a9b3cb397a283 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SupportedOperation.java @@ -0,0 +1,31 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.BaseIdentity; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Indicates which operations are available for this DF via the VNF LCM interface. + * Instantiate VNF, Query VNF and Terminate VNF are supported in all DF and + * therefore need not be included in this list. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity supported-operation {
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/supported-operation + * + */ +public interface SupportedOperation + extends + BaseIdentity +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("supported-operation"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SwapStorage.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SwapStorage.java new file mode 100644 index 0000000000000000000000000000000000000000..9c1be42cd9ad1efea71b26e11b024c21cbe9bbc9 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/SwapStorage.java @@ -0,0 +1,29 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Swap type of storage. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity swap-storage {
+ *   base storage-type;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/swap-storage + * + */ +public interface SwapStorage + extends + StorageType +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("swap-storage"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/TerminateVnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/TerminateVnf.java new file mode 100644 index 0000000000000000000000000000000000000000..2919578b5993feba05c8ddac78df37de55165c21 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/TerminateVnf.java @@ -0,0 +1,35 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This operation terminates a VNF. A VNF can be terminated gracefully or + * forcefully. Graceful termination means that the VNFM arranges to take the VNF + * out of service, e.g. by asking the VNF's EM to take the VNF out of service, and + * only after that shuts down the VNF and releases the resources. Forceful + * termination means that the VNFM immediately shuts down the VNF and releases the + * resources. A time interval can be specified for taking the VNF out of service, + * after which the VNF is shut down if taking it out of service has not completed. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * identity terminate-vnf {
+ *   base supported-operation;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/terminate-vnf + * + */ +public interface TerminateVnf + extends + SupportedOperation +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("terminate-vnf"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/VirtualNetworkInterfaceRequirements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/VirtualNetworkInterfaceRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..fa3bbb353220ce8d80b91c0a0d783defb4e57f10 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/VirtualNetworkInterfaceRequirements.java @@ -0,0 +1,78 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.VirtualNetworkInterfaceRequirement; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.VirtualNetworkInterfaceRequirementKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping virtual-network-interface-requirements {
+ *   list virtual-network-interface-requirement {
+ *     key name;
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     leaf support-mandatory {
+ *       default false;
+ *       type boolean;
+ *     }
+ *     list network-interface-requirements {
+ *       key key;
+ *       min-elements 1;
+ *       max-elements 1;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/virtual-network-interface-requirements + * + */ +public interface VirtualNetworkInterfaceRequirements + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-network-interface-requirements"); + + @Override + Class implementedInterface(); + + /** + * Specifies requirements on a virtual network interface realising the CPs + * instantiated from this CPD. + * + * + * + * @return java.util.Map virtualNetworkInterfaceRequirement, or null if not present + */ + @Nullable Map getVirtualNetworkInterfaceRequirement(); + + /** + * @return java.util.Map virtualNetworkInterfaceRequirement, or an empty list if it is not present + */ + default @NonNull Map nonnullVirtualNetworkInterfaceRequirement() { + return CodeHelpers.nonnull(getVirtualNetworkInterfaceRequirement()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Vnfd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Vnfd.java new file mode 100644 index 0000000000000000000000000000000000000000..27db5c08c80446e628e7c0af6bc26057c6f67057 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/Vnfd.java @@ -0,0 +1,1328 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.VnfdBuilder.VnfdImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ConfigurableProperties; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.DfKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ElementGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ElementGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ExtCpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ExtCpdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Indicator; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IndicatorKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IntVirtualLinkDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IntVirtualLinkDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.LifecycleManagementScript; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.LifecycleManagementScriptKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ModifiableAttributes; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VduKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDescKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * grouping vnfd {
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf provider {
+ *     type string;
+ *   }
+ *   leaf product-name {
+ *     type string;
+ *   }
+ *   leaf software-version {
+ *     type string;
+ *   }
+ *   leaf version {
+ *     type string;
+ *   }
+ *   leaf product-info-name {
+ *     type string;
+ *   }
+ *   leaf product-info-description {
+ *     type string;
+ *   }
+ *   leaf-list vnfm-info {
+ *     type string;
+ *     min-elements 1;
+ *   }
+ *   leaf localization-language {
+ *     type string;
+ *   }
+ *   leaf default-localization-language {
+ *     when ../localization-language;
+ *     type string;
+ *   }
+ *   list vdu {
+ *     key id;
+ *     min-elements 1;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     list int-cpd {
+ *       key id;
+ *       min-elements 1;
+ *       leaf int-virtual-link-desc {
+ *         type leafref {
+ *           path ../../../int-virtual-link-desc/id;
+ *         }
+ *       }
+ *       leaf bitrate-requirement {
+ *         type uint64;
+ *         units Mbps;
+ *       }
+ *       uses virtual-network-interface-requirements;
+ *       leaf nicio-requirements {
+ *         type leafref {
+ *           path ../../../virtual-compute-desc/id;
+ *         }
+ *       }
+ *       leaf-list order {
+ *         type uint32;
+ *       }
+ *       uses cpd;
+ *       leaf security-group-rule-id {
+ *         type leafref {
+ *           path ../../../security-group-rule/id;
+ *         }
+ *       }
+ *     }
+ *     leaf virtual-compute-desc {
+ *       type leafref {
+ *         path ../../virtual-compute-desc/id;
+ *       }
+ *       must "../../virtual-compute-desc[id=current()]/virtual-memory/size >=../../sw-image-desc[id=current()/../sw-image-desc]/min-ram";
+ *     }
+ *     leaf-list virtual-storage-desc {
+ *       type leafref {
+ *         path ../../virtual-storage-desc/id;
+ *       }
+ *     }
+ *     list boot-order {
+ *       ordered-by user;
+ *       key key;
+ *       leaf key {
+ *         type uint32;
+ *       }
+ *       leaf value {
+ *         type leafref {
+ *           path ../../virtual-storage-desc;
+ *         }
+ *       }
+ *     }
+ *     leaf sw-image-desc {
+ *       type leafref {
+ *         path ../../sw-image-desc/id;
+ *       }
+ *     }
+ *     leaf-list nfvi-constraint {
+ *       type string;
+ *     }
+ *     list monitoring-parameter {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       uses monitoring-parameter;
+ *     }
+ *     list configurable-properties {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *     leaf boot-data {
+ *       type string;
+ *     }
+ *   }
+ *   list virtual-compute-desc {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     list logical-node {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       list requirement-detail {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *     list request-additional-capability {
+ *       key name;
+ *       leaf name {
+ *         type string;
+ *       }
+ *       leaf support-mandatory {
+ *         type boolean;
+ *       }
+ *       leaf min-version {
+ *         type string;
+ *       }
+ *       leaf preferred-version {
+ *         type string;
+ *       }
+ *       list target-performance-parameters {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *     leaf compute-requirements {
+ *       type string;
+ *     }
+ *     container virtual-memory {
+ *       leaf size {
+ *         type decimal64 {
+ *           fraction-digits 1;
+ *           range 0..max;
+ *         }
+ *         units GB;
+ *         default 1;
+ *       }
+ *       leaf over-subscription-policy {
+ *         type string;
+ *       }
+ *       list vdu-mem-requirements {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *       leaf numa-enabled {
+ *         type boolean;
+ *       }
+ *     }
+ *     container virtual-cpu {
+ *       leaf cpu-architecture {
+ *         type string;
+ *       }
+ *       leaf num-virtual-cpu {
+ *         type uint16 {
+ *           range 1..max;
+ *         }
+ *         default 1;
+ *       }
+ *       leaf clock {
+ *         type uint32;
+ *         units MHz;
+ *       }
+ *       leaf oversubscription-policy {
+ *         type string;
+ *       }
+ *       list vdu-cpu-requirements {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *       container pinning {
+ *         presence "Set to specify CPU pinning.";
+ *         leaf policy {
+ *           default dynamic;
+ *           type enumeration {
+ *             enum static;
+ *             enum dynamic;
+ *           }
+ *         }
+ *         list rule {
+ *           when "../policy = 'static'";
+ *           key key;
+ *           leaf key {
+ *             type string;
+ *           }
+ *           leaf value {
+ *             type string;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ *   list virtual-storage-desc {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf type-of-storage {
+ *       default root-storage;
+ *       type identityref {
+ *         base storage-type;
+ *       }
+ *     }
+ *     leaf size-of-storage {
+ *       type uint64;
+ *       units GB;
+ *       default 0;
+ *     }
+ *     list vdu-storage-requirements {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *     leaf rdma-enabled {
+ *       type boolean;
+ *     }
+ *     leaf sw-image-desc {
+ *       type leafref {
+ *         path ../../sw-image-desc/id;
+ *       }
+ *       must "../size-of-storage >=../../sw-image-desc[id=current()]/min-disk";
+ *     }
+ *   }
+ *   list sw-image-desc {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf version {
+ *       type string;
+ *     }
+ *     container checksum {
+ *       leaf algorithm {
+ *         type identityref {
+ *           base checksum-algorithm;
+ *         }
+ *       }
+ *       leaf hash {
+ *         type string;
+ *       }
+ *     }
+ *     leaf container-format {
+ *       default bare;
+ *       type enumeration {
+ *         enum aki {
+ *         }
+ *         enum ami {
+ *         }
+ *         enum ari {
+ *         }
+ *         enum bare {
+ *         }
+ *         enum docker {
+ *         }
+ *         enum ova {
+ *         }
+ *         enum ovf {
+ *         }
+ *       }
+ *     }
+ *     leaf disk-format {
+ *       default qcow2;
+ *       type enumeration {
+ *         enum aki {
+ *         }
+ *         enum ami {
+ *         }
+ *         enum ari {
+ *         }
+ *         enum iso {
+ *         }
+ *         enum qcow2 {
+ *         }
+ *         enum raw {
+ *         }
+ *         enum vdi {
+ *         }
+ *         enum vhd {
+ *         }
+ *         enum vhdx {
+ *         }
+ *         enum vmdk {
+ *         }
+ *       }
+ *     }
+ *     leaf min-disk {
+ *       type uint64;
+ *       units GB;
+ *     }
+ *     leaf min-ram {
+ *       type decimal64 {
+ *         fraction-digits 1;
+ *         range 0..max;
+ *       }
+ *       units GB;
+ *       default 0;
+ *     }
+ *     leaf size {
+ *       type uint64;
+ *       units GB;
+ *     }
+ *     leaf image {
+ *       default .;
+ *       type inet:uri;
+ *     }
+ *     leaf operating-system {
+ *       type string;
+ *     }
+ *     leaf-list supported-virtualization-environment {
+ *       type string;
+ *     }
+ *   }
+ *   list int-virtual-link-desc {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     list flavour {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       container qos {
+ *         presence "VL QoS parameters";
+ *         leaf latency {
+ *           type uint32;
+ *           units ms;
+ *         }
+ *         leaf packet-delay-variation {
+ *           type uint32;
+ *           units ms;
+ *         }
+ *         leaf packet-loss-ratio {
+ *           type decimal64 {
+ *             fraction-digits 2;
+ *             range 0..1.00;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     uses connectivity-type;
+ *     leaf-list test-access {
+ *       type string;
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     list monitoring-parameters {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       uses monitoring-parameter;
+ *     }
+ *   }
+ *   uses security-group-rule;
+ *   list ext-cpd {
+ *     key id;
+ *     min-elements 1;
+ *     choice cp-connection {
+ *       case int-virtual-link-desc {
+ *         leaf int-virtual-link-desc {
+ *           type leafref {
+ *             path ../../int-virtual-link-desc/id;
+ *           }
+ *         }
+ *       }
+ *       case int-cpd {
+ *         container int-cpd {
+ *           leaf vdu-id {
+ *             type leafref {
+ *               path ../../../vdu/id;
+ *             }
+ *           }
+ *           leaf cpd {
+ *             type string;
+ *           }
+ *         }
+ *       }
+ *       case k8s-cluster-net {
+ *         leaf k8s-cluster-net {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *     uses virtual-network-interface-requirements;
+ *     leaf nicio-requirements {
+ *       type leafref {
+ *         path ../../virtual-compute-desc/id;
+ *       }
+ *     }
+ *     uses cpd;
+ *     leaf security-group-rule-id {
+ *       type leafref {
+ *         path ../../security-group-rule/id;
+ *       }
+ *     }
+ *   }
+ *   list df {
+ *     must "default-instantiation-level or count(instantiation-level) = 1";
+ *     key id;
+ *     min-elements 1;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     list vdu-profile {
+ *       key id;
+ *       min-elements 1;
+ *       leaf id {
+ *         type leafref {
+ *           path ../../../vdu/id;
+ *         }
+ *       }
+ *       leaf min-number-of-instances {
+ *         type uint16;
+ *         default 1;
+ *       }
+ *       leaf max-number-of-instances {
+ *         type uint16;
+ *         default 1;
+ *         must ". >= ../min-number-of-instances";
+ *       }
+ *       uses local-affinity-or-anti-affinity-rule;
+ *       list affinity-or-anti-affinity-group {
+ *         key id;
+ *         leaf id {
+ *           type leafref {
+ *             path ../../../affinity-or-anti-affinity-group/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     list virtual-link-profile {
+ *       key "id flavour";
+ *       leaf id {
+ *         type leafref {
+ *           path ../../../int-virtual-link-desc/id;
+ *         }
+ *       }
+ *       leaf flavour {
+ *         type leafref {
+ *           path ../../../flavour/id;
+ *         }
+ *       }
+ *       uses local-affinity-or-anti-affinity-rule;
+ *       list affinity-or-anti-affinity-group {
+ *         key id;
+ *         leaf id {
+ *           type leafref {
+ *             path ../../../affinity-or-anti-affinity-group/id;
+ *           }
+ *         }
+ *       }
+ *       container max-bit-rate-requirements {
+ *         leaf root {
+ *           type uint32;
+ *         }
+ *         leaf leaf {
+ *           type uint32;
+ *         }
+ *       }
+ *       container min-bit-rate-requirements {
+ *         leaf root {
+ *           type uint32;
+ *         }
+ *         leaf leaf {
+ *           type uint32;
+ *         }
+ *       }
+ *       container virtual-link-protocol-data {
+ *         leaf associated-layer-protocol {
+ *           type identityref {
+ *             base layer-protocol;
+ *           }
+ *         }
+ *         container l2-protocol-data {
+ *           when "(../associated-layer-protocol = 'Ethernet') or (../associated-layer-protocol = 'MPLS') or (../associated-layer-protocol = 'ODU2') or (../associated-layer-protocol = 'Pseudo-Wire')";
+ *           leaf name {
+ *             type string;
+ *           }
+ *           leaf network-type {
+ *             type enumeration {
+ *               enum flat;
+ *               enum vlan;
+ *               enum vxlan;
+ *               enum gre;
+ *             }
+ *           }
+ *           leaf vlan-transparent {
+ *             type boolean;
+ *           }
+ *           leaf mtu {
+ *             type uint16;
+ *           }
+ *         }
+ *         container l3-protocol-data {
+ *           when "(../associated-layer-protocol = 'IPv4') or (../associated-layer-protocol = 'IPv6')";
+ *           leaf name {
+ *             type string;
+ *           }
+ *           leaf ip-version {
+ *             type enumeration {
+ *               enum ipv4;
+ *               enum ipv6;
+ *             }
+ *             default ipv4;
+ *           }
+ *           leaf cidr {
+ *             type string;
+ *           }
+ *           leaf-list ip-allocation-pools {
+ *             type string;
+ *           }
+ *           leaf gateway-ip {
+ *             type inet:ip-address;
+ *           }
+ *           leaf dhcp-enabled {
+ *             type boolean;
+ *             default true;
+ *           }
+ *           leaf ipv6-address-mode {
+ *             when "../ip-version = 'ipv6'";
+ *             type enumeration {
+ *               enum slaac;
+ *               enum dhcpv6-stateful;
+ *               enum dhcpv6-stateless;
+ *             }
+ *           }
+ *         }
+ *       }
+ *     }
+ *     list instantiation-level {
+ *       key id;
+ *       min-elements 1;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf description {
+ *         type string;
+ *       }
+ *       list vdu-level {
+ *         key vdu-id;
+ *         min-elements 1;
+ *         leaf vdu-id {
+ *           type leafref {
+ *             path ../../../../vdu/id;
+ *           }
+ *         }
+ *         leaf number-of-instances {
+ *           type uint16;
+ *           must ". <= ../../../../df/vdu-profile[id=current()/../vdu-id]/max-number-of-instances";
+ *           must ". >= ../../../../df/vdu-profile[id=current()/../vdu-id]/min-number-of-instances";
+ *           default 1;
+ *         }
+ *       }
+ *       list scaling-info {
+ *         key scaling-aspect-id;
+ *         leaf scaling-aspect-id {
+ *           type leafref {
+ *             path ../../../scaling-aspect/id;
+ *           }
+ *         }
+ *         leaf scale-level {
+ *           type uint32;
+ *         }
+ *       }
+ *     }
+ *     leaf default-instantiation-level {
+ *       type leafref {
+ *         path ../instantiation-level/id;
+ *       }
+ *     }
+ *     leaf-list supported-operation {
+ *       type identityref {
+ *         base supported-operation;
+ *       }
+ *     }
+ *     container lcm-operations-configuration {
+ *       container instantiate-vnf-op-config {
+ *         list parameter {
+ *           key key;
+ *           leaf key {
+ *             type string;
+ *           }
+ *           leaf value {
+ *             type string;
+ *           }
+ *         }
+ *       }
+ *       container scale-vnf-op-config {
+ *         list parameter {
+ *           key key;
+ *           leaf key {
+ *             type string;
+ *           }
+ *           leaf value {
+ *             type string;
+ *           }
+ *         }
+ *         leaf scaling-by-more-than-one-step-supported {
+ *           type boolean;
+ *           default false;
+ *         }
+ *       }
+ *       container scale-vnf-to-level-op-config {
+ *         list parameter {
+ *           key key;
+ *           leaf key {
+ *             type string;
+ *           }
+ *           leaf value {
+ *             type string;
+ *           }
+ *         }
+ *         leaf arbitrary-target-levels-supported {
+ *           type boolean;
+ *           default false;
+ *         }
+ *       }
+ *       container heal-vnf-op-config {
+ *         list parameter {
+ *           key key;
+ *           leaf key {
+ *             type string;
+ *           }
+ *           leaf value {
+ *             type string;
+ *           }
+ *         }
+ *         leaf-list cause {
+ *           type string;
+ *         }
+ *       }
+ *       container terminate-vnf-op-config {
+ *         leaf min-graceful-termination {
+ *           type yang:timeticks;
+ *           default 1;
+ *         }
+ *         leaf max-recommended-graceful-termination {
+ *           type yang:timeticks;
+ *         }
+ *         list parameter {
+ *           key key;
+ *           leaf key {
+ *             type string;
+ *           }
+ *           leaf value {
+ *             type string;
+ *           }
+ *         }
+ *       }
+ *       container operate-vnf-op-config {
+ *         leaf min-graceful-stop-timeout {
+ *           type yang:timeticks;
+ *           default 1;
+ *         }
+ *         leaf max-recommended-graceful-stop-timeout {
+ *           type yang:timeticks;
+ *         }
+ *         list parameter {
+ *           key key;
+ *           leaf key {
+ *             type string;
+ *           }
+ *           leaf value {
+ *             type string;
+ *           }
+ *         }
+ *       }
+ *       container change-vnf-flavour-op-config {
+ *         list parameter {
+ *           key key;
+ *           leaf key {
+ *             type string;
+ *           }
+ *           leaf value {
+ *             type string;
+ *           }
+ *         }
+ *       }
+ *       container change-ext-vnf-connectivity-op-config {
+ *         list parameter {
+ *           key key;
+ *           leaf key {
+ *             type string;
+ *           }
+ *           leaf value {
+ *             type string;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     list affinity-or-anti-affinity-group {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf type {
+ *         type affinity-type;
+ *       }
+ *       leaf scope {
+ *         type affinity-scope;
+ *       }
+ *     }
+ *     list indicator {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf name {
+ *         type string;
+ *       }
+ *       leaf indicator-value {
+ *         type string;
+ *       }
+ *       leaf source {
+ *         type enumeration {
+ *           enum vnf;
+ *           enum em;
+ *           enum both;
+ *         }
+ *       }
+ *     }
+ *     list supported-vnf-interfaces {
+ *       key name;
+ *       leaf name {
+ *         type enumeration {
+ *           enum vnf-configuration;
+ *           enum vnf-indicator;
+ *         }
+ *       }
+ *       leaf-list cpd-id {
+ *         type leafref {
+ *           path ../../../ext-cpd/id;
+ *         }
+ *       }
+ *       list interface-details {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *     list monitoring-parameter {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       uses monitoring-parameter;
+ *     }
+ *     list scaling-aspect {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf name {
+ *         type string;
+ *       }
+ *       leaf description {
+ *         type string;
+ *       }
+ *       leaf max-scale-level {
+ *         type uint32 {
+ *           range 1..max;
+ *         }
+ *       }
+ *       container aspect-delta-details {
+ *         list deltas {
+ *           key id;
+ *           min-elements 1;
+ *           leaf id {
+ *             type string;
+ *           }
+ *           list vdu-delta {
+ *             key id;
+ *             leaf id {
+ *               type leafref {
+ *                 path ../../../../../../vdu/id;
+ *               }
+ *             }
+ *             leaf number-of-instances {
+ *               type uint32 {
+ *                 range 0..max;
+ *               }
+ *             }
+ *           }
+ *           list virtual-link-bit-rate-delta {
+ *             key id;
+ *             leaf id {
+ *               type string;
+ *             }
+ *             container bit-rate-requirements {
+ *               leaf root {
+ *                 type uint32;
+ *                 units bits/sec;
+ *               }
+ *               leaf leaf {
+ *                 type uint32;
+ *                 units bits/sec;
+ *               }
+ *             }
+ *           }
+ *         }
+ *         leaf step-deltas {
+ *           type leafref {
+ *             path ../deltas/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ *   container configurable-properties {
+ *     leaf is-auto-scalable-enabled {
+ *       type boolean;
+ *     }
+ *     leaf is-auto-heal-enabled {
+ *       type boolean;
+ *     }
+ *     list additional-configurable-property {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   container modifiable-attributes {
+ *     leaf-list extension {
+ *       type string;
+ *     }
+ *     leaf-list metadata {
+ *       type string;
+ *     }
+ *   }
+ *   list lifecycle-management-script {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf-list event {
+ *       type internal-lifecycle-management-script-event;
+ *     }
+ *     leaf-list lcm-transition-event {
+ *       type string;
+ *     }
+ *     leaf script {
+ *       type string;
+ *     }
+ *     leaf script-dsl {
+ *       type string;
+ *     }
+ *     list script-input {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   list element-group {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     leaf-list vdu {
+ *       type leafref {
+ *         path ../../vdu/id;
+ *       }
+ *     }
+ *     leaf-list virtual-link-desc {
+ *       type leafref {
+ *         path ../../int-virtual-link-desc/id;
+ *       }
+ *     }
+ *   }
+ *   list indicator {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf-list indicator-value {
+ *       type string;
+ *     }
+ *     leaf source {
+ *       type enumeration {
+ *         enum vnf;
+ *         enum em;
+ *         enum both;
+ *       }
+ *     }
+ *   }
+ *   leaf-list auto-scale {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd + * + */ +@JsonDeserialize(as = VnfdImpl.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public interface Vnfd + extends + DataObject, + SecurityGroupRule +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnfd"); + + @Override + Class implementedInterface(); + + /** + * Identifier of this VNFD information element. This attribute shall be globally + * unique. The format will be defined in the data model specification phase. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Provider of the VNF and of the VNFD + * + * + * + * @return java.lang.String provider, or null if not present + */ + @Nullable String getProvider(); + + /** + * Name to identify the VNF Product. Invariant for the VNF Product lifetime. + * + * + * + * @return java.lang.String productName, or null if not present + */ + @Nullable String getProductName(); + + /** + * Software version of the VNF. This is changed when there is any change to the + * software that is included in the VNF Package + * + * + * + * @return java.lang.String softwareVersion, or null if not present + */ + @Nullable String getSoftwareVersion(); + + /** + * Identifies the version of the VNFD + * + * + * + * @return java.lang.String version, or null if not present + */ + @Nullable String getVersion(); + + /** + * Human readable name of the VNFD. Can change during the VNF Product lifetime. + * + * + * + * @return java.lang.String productInfoName, or null if not present + */ + @Nullable String getProductInfoName(); + + /** + * Human readable description of the VNFD. Can change during the VNF Product + * lifetime. + * + * + * + * @return java.lang.String productInfoDescription, or null if not present + */ + @Nullable String getProductInfoDescription(); + + /** + * Identifies VNFM(s) compatible with the VNF described in this version of the + * VNFD. + * + * + * + * @return java.util.List vnfmInfo, or null if not present + */ + @Nullable List getVnfmInfo(); + + /** + * Information about the language of the VNF. + * + * + * + * @return java.lang.String localizationLanguage, or null if not present + */ + @Nullable String getLocalizationLanguage(); + + /** + * Default localization language that is instantiated if no information about + * selected localization language is available. Shall be present if + * 'localization-language' is present and shall be absent otherwise. + * + * + * + * @return java.lang.String defaultLocalizationLanguage, or null if not present + */ + @Nullable String getDefaultLocalizationLanguage(); + + /** + * The Virtualisation Deployment Unit (VDU) is a construct supporting the + * description of the deployment and operational behaviour of a VNF component, or + * the entire VNF if it was not componentized in components. + * + * + * + * @return java.util.Map vdu, or null if not present + */ + @Nullable Map getVdu(); + + /** + * @return java.util.Map vdu, or an empty list if it is not present + */ + default @NonNull Map nonnullVdu() { + return CodeHelpers.nonnull(getVdu()); + } + + /** + * Defines descriptors of virtual compute resources to be used by the VNF. + * + * + * + * @return java.util.Map virtualComputeDesc, or null if not present + */ + @Nullable Map getVirtualComputeDesc(); + + /** + * @return java.util.Map virtualComputeDesc, or an empty list if it is not present + */ + default @NonNull Map nonnullVirtualComputeDesc() { + return CodeHelpers.nonnull(getVirtualComputeDesc()); + } + + /** + * Storage requirements for a Virtual Storage instance attached to the VNFC created + * from this VDU + * + * + * + * @return java.util.Map virtualStorageDesc, or null if not present + */ + @Nullable Map getVirtualStorageDesc(); + + /** + * @return java.util.Map virtualStorageDesc, or an empty list if it is not present + */ + default @NonNull Map nonnullVirtualStorageDesc() { + return CodeHelpers.nonnull(getVirtualStorageDesc()); + } + + /** + * Defines descriptors of software images to be used by the VNF. + * + * + * + * @return java.util.Map swImageDesc, or null if not present + */ + @Nullable Map getSwImageDesc(); + + /** + * @return java.util.Map swImageDesc, or an empty list if it is not present + */ + default @NonNull Map nonnullSwImageDesc() { + return CodeHelpers.nonnull(getSwImageDesc()); + } + + /** + * Represents the type of network connectivity mandated by the VNF provider between + * two or more CPs which includes at least one internal CP. + * + * + * + * @return java.util.Map intVirtualLinkDesc, or null if not present + */ + @Nullable Map getIntVirtualLinkDesc(); + + /** + * @return java.util.Map intVirtualLinkDesc, or an empty list if it is not present + */ + default @NonNull Map nonnullIntVirtualLinkDesc() { + return CodeHelpers.nonnull(getIntVirtualLinkDesc()); + } + + /** + * Describes an external interface exposed by this VNF enabling connection with a + * Virual Link + * + * + * + * @return java.util.Map extCpd, or null if not present + */ + @Nullable Map getExtCpd(); + + /** + * @return java.util.Map extCpd, or an empty list if it is not present + */ + default @NonNull Map nonnullExtCpd() { + return CodeHelpers.nonnull(getExtCpd()); + } + + /** + * Describes a specific Deployment Flavour (DF) of a VNF with specific requirements + * for capacity and performance. + * + * + * + * @return java.util.Map df, or null if not present + */ + @Nullable Map getDf(); + + /** + * @return java.util.Map df, or an empty list if it is not present + */ + default @NonNull Map nonnullDf() { + return CodeHelpers.nonnull(getDf()); + } + + /** + * Describes the configurable properties of the VNF (e.g. related to auto scaling + * and auto healing). + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ConfigurableProperties configurableProperties, or null if not present + */ + @Nullable ConfigurableProperties getConfigurableProperties(); + + /** + * Describes the modifiable attributes of the VNF. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ModifiableAttributes modifiableAttributes, or null if not present + */ + @Nullable ModifiableAttributes getModifiableAttributes(); + + /** + * Includes a list of events and corresponding management scripts performed for the + * VNF. + * + * + * + * @return java.util.Map lifecycleManagementScript, or null if not present + */ + @Nullable Map getLifecycleManagementScript(); + + /** + * @return java.util.Map lifecycleManagementScript, or an empty list if it is not present + */ + default @NonNull Map nonnullLifecycleManagementScript() { + return CodeHelpers.nonnull(getLifecycleManagementScript()); + } + + /** + * Describes the associated elements of a VNFD for a certain purpose during VNF + * lifecycle management. + * + * + * + * @return java.util.Map elementGroup, or null if not present + */ + @Nullable Map getElementGroup(); + + /** + * @return java.util.Map elementGroup, or an empty list if it is not present + */ + default @NonNull Map nonnullElementGroup() { + return CodeHelpers.nonnull(getElementGroup()); + } + + /** + * Declares the VNF indicators that are supported by this VNF. + * + * + * + * @return java.util.Map indicator, or null if not present + */ + @Nullable Map getIndicator(); + + /** + * @return java.util.Map indicator, or an empty list if it is not present + */ + default @NonNull Map nonnullIndicator() { + return CodeHelpers.nonnull(getIndicator()); + } + + /** + * Rule that determines when a scaling action needs to be triggered on a VNF + * instance e.g. based on certain VNF indicator values or VNF indicator value + * changes or a combination of VNF indicator value(s) and monitoring parameter(s). + * + * + * + * @return java.util.List autoScale, or null if not present + */ + @Nullable List getAutoScale(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/connectivity/type/ConnectivityType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/connectivity/type/ConnectivityType.java new file mode 100644 index 0000000000000000000000000000000000000000..6c04aa7807c48b7bd13200c77275e2502f58463c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/connectivity/type/ConnectivityType.java @@ -0,0 +1,73 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.connectivity.type; +import java.lang.Class; +import java.lang.Override; +import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.FlowPattern; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container connectivity-type {
+ *   leaf-list layer-protocol {
+ *     type identityref {
+ *       base layer-protocol;
+ *     }
+ *   }
+ *   leaf flow-pattern {
+ *     type flow-pattern;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/connectivity-type/connectivity-type + * + *

To create instances of this class use {@link ConnectivityTypeBuilder}. + * @see ConnectivityTypeBuilder + * + */ +public interface ConnectivityType + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("connectivity-type"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.connectivity.type.ConnectivityType.class; + } + + /** + * Identifies the protocols that the VL uses (Ethernet, MPLS, ODU2, IPV4, IPV6, + * Pseudo-Wire). The top layer protocol of the VL protocol stack shall always be + * provided. The lower layer protocols may be included when there are specific + * requirements on these layers. + * + * + * + * @return java.util.List layerProtocol, or null if not present + */ + @Nullable List> getLayerProtocol(); + + /** + * Identifies the flow pattern of the connectivity (Line, Tree, Mesh). + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.FlowPattern flowPattern, or null if not present + */ + @Nullable FlowPattern getFlowPattern(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/connectivity/type/ConnectivityTypeBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/connectivity/type/ConnectivityTypeBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..56e6d61653d194ab19a3d5dac178cb900d0950d7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/connectivity/type/ConnectivityTypeBuilder.java @@ -0,0 +1,253 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.connectivity.type; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.FlowPattern; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ConnectivityTypeBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ConnectivityTypeBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ConnectivityTypeBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ConnectivityTypeBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ConnectivityTypeBuilder + * @see Builder + * + */ +public class ConnectivityTypeBuilder implements Builder { + + private FlowPattern _flowPattern; + private List> _layerProtocol; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ConnectivityTypeBuilder() { + } + + public ConnectivityTypeBuilder(ConnectivityType base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._flowPattern = base.getFlowPattern(); + this._layerProtocol = base.getLayerProtocol(); + } + + + public FlowPattern getFlowPattern() { + return _flowPattern; + } + + public List> getLayerProtocol() { + return _layerProtocol; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public ConnectivityTypeBuilder setFlowPattern(final FlowPattern value) { + this._flowPattern = value; + return this; + } + public ConnectivityTypeBuilder setLayerProtocol(final List> values) { + this._layerProtocol = values; + return this; + } + + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ConnectivityTypeBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ConnectivityTypeBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ConnectivityTypeBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ConnectivityTypeBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ConnectivityType build() { + return new ConnectivityTypeImpl(this); + } + + private static final class ConnectivityTypeImpl + extends AbstractAugmentable + implements ConnectivityType { + + private final FlowPattern _flowPattern; + private final List> _layerProtocol; + + ConnectivityTypeImpl(ConnectivityTypeBuilder base) { + super(base.augmentation); + this._flowPattern = base.getFlowPattern(); + this._layerProtocol = base.getLayerProtocol(); + } + + @Override + public FlowPattern getFlowPattern() { + return _flowPattern; + } + + @Override + public List> getLayerProtocol() { + return _layerProtocol; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_flowPattern); + result = prime * result + Objects.hashCode(_layerProtocol); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ConnectivityType.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ConnectivityType other = (ConnectivityType)obj; + if (!Objects.equals(_flowPattern, other.getFlowPattern())) { + return false; + } + if (!Objects.equals(_layerProtocol, other.getLayerProtocol())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ConnectivityTypeImpl otherImpl = (ConnectivityTypeImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ConnectivityType"); + CodeHelpers.appendValue(helper, "_flowPattern", _flowPattern); + CodeHelpers.appendValue(helper, "_layerProtocol", _layerProtocol); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/Protocol.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/Protocol.java new file mode 100644 index 0000000000000000000000000000000000000000..a0e01e30d5a4a1896a59ca89aa3e6c1939f822dc --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/Protocol.java @@ -0,0 +1,122 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.AddressData; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.AddressDataKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Identifies the protocol layering information the CP uses for connectivity + * purposes and associated information. There shall be one cpProtocol for each + * layer protocol as indicated by the attribute layerProtocol. When a PnfExtCpd as + * defined in ETSI GS NFV-IFA 014 [i.8] is inherited from this Cpd, the + * is set to 0. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list protocol {
+ *   key associated-layer-protocol;
+ *   leaf associated-layer-protocol {
+ *     type identityref {
+ *       base layer-protocol;
+ *     }
+ *   }
+ *   list address-data {
+ *     key type;
+ *     leaf type {
+ *       type identityref {
+ *         base address-type;
+ *       }
+ *     }
+ *     container l2-address-data {
+ *       when "../type='mac-address'";
+ *       leaf mac-address-assignment {
+ *         type boolean;
+ *       }
+ *     }
+ *     container l3-address-data {
+ *       when "../type='ip-address'";
+ *       leaf ip-address-assignment {
+ *         type boolean;
+ *       }
+ *       leaf floating-ip-activated {
+ *         type boolean;
+ *       }
+ *       leaf ip-address-type {
+ *         type enumeration {
+ *           enum ipv4;
+ *           enum ipv6;
+ *         }
+ *       }
+ *       leaf number-of-ip-addresses {
+ *         type uint32;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/cpd/protocol + * + *

To create instances of this class use {@link ProtocolBuilder}. + * @see ProtocolBuilder + * @see ProtocolKey + * + */ +public interface Protocol + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("protocol"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.Protocol.class; + } + + /** + * One of the values of the attribute layerProtocol of the Cpd IE. + * + * + * + * @return java.lang.Class associatedLayerProtocol, or null if not present + */ + @Nullable Class getAssociatedLayerProtocol(); + + /** + * Provides information on the addresses to be assigned to the CP(s) instantiated + * from the CPD. + * + * + * + * @return java.util.Map addressData, or null if not present + */ + @Nullable Map getAddressData(); + + /** + * @return java.util.Map addressData, or an empty list if it is not present + */ + default @NonNull Map nonnullAddressData() { + return CodeHelpers.nonnull(getAddressData()); + } + + @Override + ProtocolKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/ProtocolBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/ProtocolBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..3f666224891b31da8eee51c5ea1a940f27544c41 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/ProtocolBuilder.java @@ -0,0 +1,292 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.AddressData; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.AddressDataKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ProtocolBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ProtocolBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ProtocolBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ProtocolBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ProtocolBuilder + * @see Builder + * + */ +public class ProtocolBuilder implements Builder { + + private Map _addressData; + private Class _associatedLayerProtocol; + private ProtocolKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ProtocolBuilder() { + } + + public ProtocolBuilder(Protocol base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._associatedLayerProtocol = base.getAssociatedLayerProtocol(); + this._addressData = base.getAddressData(); + } + + + public ProtocolKey key() { + return key; + } + + public Map getAddressData() { + return _addressData; + } + + public Class getAssociatedLayerProtocol() { + return _associatedLayerProtocol; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ProtocolBuilder withKey(final ProtocolKey key) { + this.key = key; + return this; + } + public ProtocolBuilder setAddressData(final Map values) { + this._addressData = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setAddressData(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ProtocolBuilder setAddressData(final List values) { + return setAddressData(CodeHelpers.compatMap(values)); + } + + public ProtocolBuilder setAssociatedLayerProtocol(final Class value) { + this._associatedLayerProtocol = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ProtocolBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ProtocolBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ProtocolBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ProtocolBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Protocol build() { + return new ProtocolImpl(this); + } + + private static final class ProtocolImpl + extends AbstractAugmentable + implements Protocol { + + private final Map _addressData; + private final Class _associatedLayerProtocol; + private final ProtocolKey key; + + ProtocolImpl(ProtocolBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ProtocolKey(base.getAssociatedLayerProtocol()); + } + this._associatedLayerProtocol = key.getAssociatedLayerProtocol(); + this._addressData = CodeHelpers.emptyToNull(base.getAddressData()); + } + + @Override + public ProtocolKey key() { + return key; + } + + @Override + public Map getAddressData() { + return _addressData; + } + + @Override + public Class getAssociatedLayerProtocol() { + return _associatedLayerProtocol; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_addressData); + result = prime * result + Objects.hashCode(_associatedLayerProtocol); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Protocol.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Protocol other = (Protocol)obj; + if (!Objects.equals(_addressData, other.getAddressData())) { + return false; + } + if (!Objects.equals(_associatedLayerProtocol, other.getAssociatedLayerProtocol())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ProtocolImpl otherImpl = (ProtocolImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Protocol"); + CodeHelpers.appendValue(helper, "_addressData", _addressData); + CodeHelpers.appendValue(helper, "_associatedLayerProtocol", _associatedLayerProtocol); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/ProtocolKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/ProtocolKey.java new file mode 100644 index 0000000000000000000000000000000000000000..649a55fe586370a33c21cf9c68867fa904bbfc2f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/ProtocolKey.java @@ -0,0 +1,64 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ProtocolKey + implements Identifier { + private static final long serialVersionUID = -7029882376556824581L; + private final Class _associatedLayerProtocol; + + + public ProtocolKey(Class _associatedLayerProtocol) { + + this._associatedLayerProtocol = _associatedLayerProtocol; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ProtocolKey(ProtocolKey source) { + this._associatedLayerProtocol = source._associatedLayerProtocol; + } + + + public Class getAssociatedLayerProtocol() { + return _associatedLayerProtocol; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_associatedLayerProtocol); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ProtocolKey)) { + return false; + } + final ProtocolKey other = (ProtocolKey) obj; + if (!Objects.equals(_associatedLayerProtocol, other._associatedLayerProtocol)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ProtocolKey.class); + CodeHelpers.appendValue(helper, "_associatedLayerProtocol", _associatedLayerProtocol); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/AddressData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/AddressData.java new file mode 100644 index 0000000000000000000000000000000000000000..004e339974b964d22abbc04605b6d6770c09c678 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/AddressData.java @@ -0,0 +1,111 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AddressType; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.Protocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data.L2AddressData; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data.L3AddressData; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Provides information on the addresses to be assigned to the CP(s) instantiated + * from the CPD. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list address-data {
+ *   key type;
+ *   leaf type {
+ *     type identityref {
+ *       base address-type;
+ *     }
+ *   }
+ *   container l2-address-data {
+ *     when "../type='mac-address'";
+ *     leaf mac-address-assignment {
+ *       type boolean;
+ *     }
+ *   }
+ *   container l3-address-data {
+ *     when "../type='ip-address'";
+ *     leaf ip-address-assignment {
+ *       type boolean;
+ *     }
+ *     leaf floating-ip-activated {
+ *       type boolean;
+ *     }
+ *     leaf ip-address-type {
+ *       type enumeration {
+ *         enum ipv4;
+ *         enum ipv6;
+ *       }
+ *     }
+ *     leaf number-of-ip-addresses {
+ *       type uint32;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/cpd/protocol/address-data + * + *

To create instances of this class use {@link AddressDataBuilder}. + * @see AddressDataBuilder + * @see AddressDataKey + * + */ +public interface AddressData + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("address-data"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.AddressData.class; + } + + /** + * Describes the type of the address to be assigned to the CP instantiated from the + * parent CPD. Value: • MAC address. • IP address. • Etc. The content type shall be + * aligned with the address type supported by the layerProtocol attribute of the + * parent CPD. + * + * + * + * @return java.lang.Class type, or null if not present + */ + @Nullable Class getType(); + + /** + * Provides the information on the MAC addresses to be assigned to the CP(s) + * instantiated from the parent CPD. Shall be present when the addressType is MAC + * address. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data.L2AddressData l2AddressData, or null if not present + */ + @Nullable L2AddressData getL2AddressData(); + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data.L3AddressData l3AddressData, or null if not present + */ + @Nullable L3AddressData getL3AddressData(); + + @Override + AddressDataKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/AddressDataBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/AddressDataBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..82d5805b396e9fdd67a74c6047d92c4132ae6dc6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/AddressDataBuilder.java @@ -0,0 +1,297 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AddressType; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data.L2AddressData; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data.L3AddressData; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link AddressDataBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AddressDataBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AddressDataBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AddressDataBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AddressDataBuilder + * @see Builder + * + */ +public class AddressDataBuilder implements Builder { + + private L2AddressData _l2AddressData; + private L3AddressData _l3AddressData; + private Class _type; + private AddressDataKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AddressDataBuilder() { + } + + public AddressDataBuilder(AddressData base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._type = base.getType(); + this._l2AddressData = base.getL2AddressData(); + this._l3AddressData = base.getL3AddressData(); + } + + + public AddressDataKey key() { + return key; + } + + public L2AddressData getL2AddressData() { + return _l2AddressData; + } + + public L3AddressData getL3AddressData() { + return _l3AddressData; + } + + public Class getType() { + return _type; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AddressDataBuilder withKey(final AddressDataKey key) { + this.key = key; + return this; + } + + public AddressDataBuilder setL2AddressData(final L2AddressData value) { + this._l2AddressData = value; + return this; + } + + public AddressDataBuilder setL3AddressData(final L3AddressData value) { + this._l3AddressData = value; + return this; + } + + public AddressDataBuilder setType(final Class value) { + this._type = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AddressDataBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AddressDataBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AddressDataBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AddressDataBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public AddressData build() { + return new AddressDataImpl(this); + } + + private static final class AddressDataImpl + extends AbstractAugmentable + implements AddressData { + + private final L2AddressData _l2AddressData; + private final L3AddressData _l3AddressData; + private final Class _type; + private final AddressDataKey key; + + AddressDataImpl(AddressDataBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new AddressDataKey(base.getType()); + } + this._type = key.getType(); + this._l2AddressData = base.getL2AddressData(); + this._l3AddressData = base.getL3AddressData(); + } + + @Override + public AddressDataKey key() { + return key; + } + + @Override + public L2AddressData getL2AddressData() { + return _l2AddressData; + } + + @Override + public L3AddressData getL3AddressData() { + return _l3AddressData; + } + + @Override + public Class getType() { + return _type; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_l2AddressData); + result = prime * result + Objects.hashCode(_l3AddressData); + result = prime * result + Objects.hashCode(_type); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!AddressData.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + AddressData other = (AddressData)obj; + if (!Objects.equals(_l2AddressData, other.getL2AddressData())) { + return false; + } + if (!Objects.equals(_l3AddressData, other.getL3AddressData())) { + return false; + } + if (!Objects.equals(_type, other.getType())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AddressDataImpl otherImpl = (AddressDataImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("AddressData"); + CodeHelpers.appendValue(helper, "_l2AddressData", _l2AddressData); + CodeHelpers.appendValue(helper, "_l3AddressData", _l3AddressData); + CodeHelpers.appendValue(helper, "_type", _type); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/AddressDataKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/AddressDataKey.java new file mode 100644 index 0000000000000000000000000000000000000000..67327afade9994ca562a18fcbf8a8e949ab390b3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/AddressDataKey.java @@ -0,0 +1,64 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AddressType; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class AddressDataKey + implements Identifier { + private static final long serialVersionUID = 8153895744830229393L; + private final Class _type; + + + public AddressDataKey(Class _type) { + + this._type = _type; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public AddressDataKey(AddressDataKey source) { + this._type = source._type; + } + + + public Class getType() { + return _type; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_type); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof AddressDataKey)) { + return false; + } + final AddressDataKey other = (AddressDataKey) obj; + if (!Objects.equals(_type, other._type)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(AddressDataKey.class); + CodeHelpers.appendValue(helper, "_type", _type); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L2AddressData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L2AddressData.java new file mode 100644 index 0000000000000000000000000000000000000000..d74bde367450f3b88adf13e774a0a5543c9097b2 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L2AddressData.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.AddressData; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Provides the information on the MAC addresses to be assigned to the CP(s) + * instantiated from the parent CPD. Shall be present when the addressType is MAC + * address. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container l2-address-data {
+ *   when "../type='mac-address'";
+ *   leaf mac-address-assignment {
+ *     type boolean;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/cpd/protocol/address-data/l2-address-data + * + *

To create instances of this class use {@link L2AddressDataBuilder}. + * @see L2AddressDataBuilder + * + */ +public interface L2AddressData + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("l2-address-data"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data.L2AddressData.class; + } + + /** + * Specify if the MAC address assignment is the responsibility of management and + * orchestration function or not. If it is set to True, it is the management and + * orchestration function responsibility. If it is set to False, it will be + * provided by an external entity, e.g. OSS/BSS. + * + * + * + * @return java.lang.Boolean macAddressAssignment, or null if not present + */ + @Nullable Boolean isMacAddressAssignment(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L2AddressDataBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L2AddressDataBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..be279146fd45e848b489879ad89aea0cd4318887 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L2AddressDataBuilder.java @@ -0,0 +1,228 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link L2AddressDataBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     L2AddressDataBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new L2AddressDataBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of L2AddressDataBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see L2AddressDataBuilder + * @see Builder + * + */ +public class L2AddressDataBuilder implements Builder { + + private Boolean _macAddressAssignment; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public L2AddressDataBuilder() { + } + + public L2AddressDataBuilder(L2AddressData base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._macAddressAssignment = base.isMacAddressAssignment(); + } + + + public Boolean isMacAddressAssignment() { + return _macAddressAssignment; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public L2AddressDataBuilder setMacAddressAssignment(final Boolean value) { + this._macAddressAssignment = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public L2AddressDataBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public L2AddressDataBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public L2AddressDataBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private L2AddressDataBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public L2AddressData build() { + return new L2AddressDataImpl(this); + } + + private static final class L2AddressDataImpl + extends AbstractAugmentable + implements L2AddressData { + + private final Boolean _macAddressAssignment; + + L2AddressDataImpl(L2AddressDataBuilder base) { + super(base.augmentation); + this._macAddressAssignment = base.isMacAddressAssignment(); + } + + @Override + public Boolean isMacAddressAssignment() { + return _macAddressAssignment; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_macAddressAssignment); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!L2AddressData.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + L2AddressData other = (L2AddressData)obj; + if (!Objects.equals(_macAddressAssignment, other.isMacAddressAssignment())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + L2AddressDataImpl otherImpl = (L2AddressDataImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("L2AddressData"); + CodeHelpers.appendValue(helper, "_macAddressAssignment", _macAddressAssignment); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L3AddressData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L3AddressData.java new file mode 100644 index 0000000000000000000000000000000000000000..64cf61e6508eb4bd504cb206479ba2fb6304aeae --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L3AddressData.java @@ -0,0 +1,168 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.AddressData; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container l3-address-data {
+ *   when "../type='ip-address'";
+ *   leaf ip-address-assignment {
+ *     type boolean;
+ *   }
+ *   leaf floating-ip-activated {
+ *     type boolean;
+ *   }
+ *   leaf ip-address-type {
+ *     type enumeration {
+ *       enum ipv4;
+ *       enum ipv6;
+ *     }
+ *   }
+ *   leaf number-of-ip-addresses {
+ *     type uint32;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/cpd/protocol/address-data/l3-address-data + * + *

To create instances of this class use {@link L3AddressDataBuilder}. + * @see L3AddressDataBuilder + * + */ +public interface L3AddressData + extends + ChildOf, + Augmentable +{ + + + public enum IpAddressType implements Enumeration { + Ipv4(0, "ipv4"), + + Ipv6(1, "ipv6") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (IpAddressType enumItem : IpAddressType.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private IpAddressType(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding IpAddressType item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding IpAddressType item, or null if no such item exists + */ + public static IpAddressType forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("l3-address-data"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data.L3AddressData.class; + } + + /** + * Specify if the address assignment is the responsibility of management and + * orchestration function or not. If it is set to True, it is the management and + * orchestration function responsibility. + * + * + * + * @return java.lang.Boolean ipAddressAssignment, or null if not present + */ + @Nullable Boolean isIpAddressAssignment(); + + /** + * Specify if the floating IP scheme is activated on the CP or not. + * + * + * + * @return java.lang.Boolean floatingIpActivated, or null if not present + */ + @Nullable Boolean isFloatingIpActivated(); + + /** + * Define address type. The address type should be aligned with the address type + * supported by the layerProtocol attribute of the parent VnfExtCpd. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data.L3AddressData.IpAddressType ipAddressType, or null if not present + */ + @Nullable IpAddressType getIpAddressType(); + + /** + * Minimum number of IP addresses to be assigned based on this L3AddressData + * information element. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 numberOfIpAddresses, or null if not present + */ + @Nullable Uint32 getNumberOfIpAddresses(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L3AddressDataBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L3AddressDataBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..cad02438713756f27c435586569385ff513646bf --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/cpd/protocol/address/data/L3AddressDataBuilder.java @@ -0,0 +1,311 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.protocol.address.data; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link L3AddressDataBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     L3AddressDataBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new L3AddressDataBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of L3AddressDataBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see L3AddressDataBuilder + * @see Builder + * + */ +public class L3AddressDataBuilder implements Builder { + + private L3AddressData.IpAddressType _ipAddressType; + private Uint32 _numberOfIpAddresses; + private Boolean _floatingIpActivated; + private Boolean _ipAddressAssignment; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public L3AddressDataBuilder() { + } + + public L3AddressDataBuilder(L3AddressData base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._ipAddressType = base.getIpAddressType(); + this._numberOfIpAddresses = base.getNumberOfIpAddresses(); + this._floatingIpActivated = base.isFloatingIpActivated(); + this._ipAddressAssignment = base.isIpAddressAssignment(); + } + + + public L3AddressData.IpAddressType getIpAddressType() { + return _ipAddressType; + } + + public Uint32 getNumberOfIpAddresses() { + return _numberOfIpAddresses; + } + + public Boolean isFloatingIpActivated() { + return _floatingIpActivated; + } + + public Boolean isIpAddressAssignment() { + return _ipAddressAssignment; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public L3AddressDataBuilder setIpAddressType(final L3AddressData.IpAddressType value) { + this._ipAddressType = value; + return this; + } + + public L3AddressDataBuilder setNumberOfIpAddresses(final Uint32 value) { + this._numberOfIpAddresses = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setNumberOfIpAddresses(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public L3AddressDataBuilder setNumberOfIpAddresses(final Long value) { + return setNumberOfIpAddresses(CodeHelpers.compatUint(value)); + } + + public L3AddressDataBuilder setFloatingIpActivated(final Boolean value) { + this._floatingIpActivated = value; + return this; + } + + public L3AddressDataBuilder setIpAddressAssignment(final Boolean value) { + this._ipAddressAssignment = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public L3AddressDataBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public L3AddressDataBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public L3AddressDataBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private L3AddressDataBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public L3AddressData build() { + return new L3AddressDataImpl(this); + } + + private static final class L3AddressDataImpl + extends AbstractAugmentable + implements L3AddressData { + + private final L3AddressData.IpAddressType _ipAddressType; + private final Uint32 _numberOfIpAddresses; + private final Boolean _floatingIpActivated; + private final Boolean _ipAddressAssignment; + + L3AddressDataImpl(L3AddressDataBuilder base) { + super(base.augmentation); + this._ipAddressType = base.getIpAddressType(); + this._numberOfIpAddresses = base.getNumberOfIpAddresses(); + this._floatingIpActivated = base.isFloatingIpActivated(); + this._ipAddressAssignment = base.isIpAddressAssignment(); + } + + @Override + public L3AddressData.IpAddressType getIpAddressType() { + return _ipAddressType; + } + + @Override + public Uint32 getNumberOfIpAddresses() { + return _numberOfIpAddresses; + } + + @Override + public Boolean isFloatingIpActivated() { + return _floatingIpActivated; + } + + @Override + public Boolean isIpAddressAssignment() { + return _ipAddressAssignment; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_ipAddressType); + result = prime * result + Objects.hashCode(_numberOfIpAddresses); + result = prime * result + Objects.hashCode(_floatingIpActivated); + result = prime * result + Objects.hashCode(_ipAddressAssignment); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!L3AddressData.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + L3AddressData other = (L3AddressData)obj; + if (!Objects.equals(_ipAddressType, other.getIpAddressType())) { + return false; + } + if (!Objects.equals(_numberOfIpAddresses, other.getNumberOfIpAddresses())) { + return false; + } + if (!Objects.equals(_floatingIpActivated, other.isFloatingIpActivated())) { + return false; + } + if (!Objects.equals(_ipAddressAssignment, other.isIpAddressAssignment())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + L3AddressDataImpl otherImpl = (L3AddressDataImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("L3AddressData"); + CodeHelpers.appendValue(helper, "_ipAddressType", _ipAddressType); + CodeHelpers.appendValue(helper, "_numberOfIpAddresses", _numberOfIpAddresses); + CodeHelpers.appendValue(helper, "_floatingIpActivated", _floatingIpActivated); + CodeHelpers.appendValue(helper, "_ipAddressAssignment", _ipAddressAssignment); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/local/affinity/or/anti/affinity/rule/LocalAffinityOrAntiAffinityRule.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/local/affinity/or/anti/affinity/rule/LocalAffinityOrAntiAffinityRule.java new file mode 100644 index 0000000000000000000000000000000000000000..a2f27c7c6ca37bd4f03c007afe61a3835f5cbcaa --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/local/affinity/or/anti/affinity/rule/LocalAffinityOrAntiAffinityRule.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityScope; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityType; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list local-affinity-or-anti-affinity-rule {
+ *   key "affinity-type affinity-scope";
+ *   leaf affinity-type {
+ *     type affinity-type;
+ *   }
+ *   leaf affinity-scope {
+ *     type affinity-scope;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/local-affinity-or-anti-affinity-rule/local-affinity-or-anti-affinity-rule + * + *

To create instances of this class use {@link LocalAffinityOrAntiAffinityRuleBuilder}. + * @see LocalAffinityOrAntiAffinityRuleBuilder + * @see LocalAffinityOrAntiAffinityRuleKey + * + */ +public interface LocalAffinityOrAntiAffinityRule + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("local-affinity-or-anti-affinity-rule"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule.LocalAffinityOrAntiAffinityRule.class; + } + + /** + * Specifies whether the rule is an affinity rule or an anti-affinity rule. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityType affinityType, or null if not present + */ + @Nullable AffinityType getAffinityType(); + + /** + * Specifies the scope of the rule, possible values are 'NFVI-PoP', 'Zone', + * 'ZoneGroup', 'NFVI-node'. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityScope affinityScope, or null if not present + */ + @Nullable AffinityScope getAffinityScope(); + + @Override + LocalAffinityOrAntiAffinityRuleKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/local/affinity/or/anti/affinity/rule/LocalAffinityOrAntiAffinityRuleBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/local/affinity/or/anti/affinity/rule/LocalAffinityOrAntiAffinityRuleBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..66b71c1f66379405e9c7a32880d481574cb0a9bc --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/local/affinity/or/anti/affinity/rule/LocalAffinityOrAntiAffinityRuleBuilder.java @@ -0,0 +1,276 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityScope; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityType; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link LocalAffinityOrAntiAffinityRuleBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     LocalAffinityOrAntiAffinityRuleBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new LocalAffinityOrAntiAffinityRuleBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of LocalAffinityOrAntiAffinityRuleBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see LocalAffinityOrAntiAffinityRuleBuilder + * @see Builder + * + */ +public class LocalAffinityOrAntiAffinityRuleBuilder implements Builder { + + private AffinityScope _affinityScope; + private AffinityType _affinityType; + private LocalAffinityOrAntiAffinityRuleKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public LocalAffinityOrAntiAffinityRuleBuilder() { + } + + public LocalAffinityOrAntiAffinityRuleBuilder(LocalAffinityOrAntiAffinityRule base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._affinityScope = base.getAffinityScope(); + this._affinityType = base.getAffinityType(); + } + + + public LocalAffinityOrAntiAffinityRuleKey key() { + return key; + } + + public AffinityScope getAffinityScope() { + return _affinityScope; + } + + public AffinityType getAffinityType() { + return _affinityType; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public LocalAffinityOrAntiAffinityRuleBuilder withKey(final LocalAffinityOrAntiAffinityRuleKey key) { + this.key = key; + return this; + } + + public LocalAffinityOrAntiAffinityRuleBuilder setAffinityScope(final AffinityScope value) { + this._affinityScope = value; + return this; + } + + public LocalAffinityOrAntiAffinityRuleBuilder setAffinityType(final AffinityType value) { + this._affinityType = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public LocalAffinityOrAntiAffinityRuleBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public LocalAffinityOrAntiAffinityRuleBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public LocalAffinityOrAntiAffinityRuleBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private LocalAffinityOrAntiAffinityRuleBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public LocalAffinityOrAntiAffinityRule build() { + return new LocalAffinityOrAntiAffinityRuleImpl(this); + } + + private static final class LocalAffinityOrAntiAffinityRuleImpl + extends AbstractAugmentable + implements LocalAffinityOrAntiAffinityRule { + + private final AffinityScope _affinityScope; + private final AffinityType _affinityType; + private final LocalAffinityOrAntiAffinityRuleKey key; + + LocalAffinityOrAntiAffinityRuleImpl(LocalAffinityOrAntiAffinityRuleBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new LocalAffinityOrAntiAffinityRuleKey(base.getAffinityScope(), base.getAffinityType()); + } + this._affinityScope = key.getAffinityScope(); + this._affinityType = key.getAffinityType(); + } + + public LocalAffinityOrAntiAffinityRuleImpl() { + this( new LocalAffinityOrAntiAffinityRuleBuilder()); + } + @Override + public LocalAffinityOrAntiAffinityRuleKey key() { + return key; + } + + @Override + public AffinityScope getAffinityScope() { + return _affinityScope; + } + + @Override + public AffinityType getAffinityType() { + return _affinityType; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_affinityScope); + result = prime * result + Objects.hashCode(_affinityType); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!LocalAffinityOrAntiAffinityRule.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + LocalAffinityOrAntiAffinityRule other = (LocalAffinityOrAntiAffinityRule)obj; + if (!Objects.equals(_affinityScope, other.getAffinityScope())) { + return false; + } + if (!Objects.equals(_affinityType, other.getAffinityType())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + LocalAffinityOrAntiAffinityRuleImpl otherImpl = (LocalAffinityOrAntiAffinityRuleImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("LocalAffinityOrAntiAffinityRule"); + CodeHelpers.appendValue(helper, "_affinityScope", _affinityScope); + CodeHelpers.appendValue(helper, "_affinityType", _affinityType); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/local/affinity/or/anti/affinity/rule/LocalAffinityOrAntiAffinityRuleKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/local/affinity/or/anti/affinity/rule/LocalAffinityOrAntiAffinityRuleKey.java new file mode 100644 index 0000000000000000000000000000000000000000..a61afd7906f38b9ea03f5999c01c7256e7537f42 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/local/affinity/or/anti/affinity/rule/LocalAffinityOrAntiAffinityRuleKey.java @@ -0,0 +1,94 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.KeyDeserializer; +import com.google.common.base.MoreObjects; + +import java.io.IOException; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityScope; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityType; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class LocalAffinityOrAntiAffinityRuleKey extends KeyDeserializer + implements Identifier { + private static final long serialVersionUID = -2457432228320345751L; + private final AffinityType _affinityType; + private final AffinityScope _affinityScope; + + + public LocalAffinityOrAntiAffinityRuleKey() { + this._affinityType = null; + this._affinityScope = null; + } + + public LocalAffinityOrAntiAffinityRuleKey(AffinityScope _affinityScope, AffinityType _affinityType) { + + this._affinityType = _affinityType; + this._affinityScope = _affinityScope; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public LocalAffinityOrAntiAffinityRuleKey(LocalAffinityOrAntiAffinityRuleKey source) { + this._affinityType = source._affinityType; + this._affinityScope = source._affinityScope; + } + + + public AffinityType getAffinityType() { + return _affinityType; + } + + public AffinityScope getAffinityScope() { + return _affinityScope; + } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_affinityType); + result = prime * result + Objects.hashCode(_affinityScope); + return result; + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof LocalAffinityOrAntiAffinityRuleKey)) { + return false; + } + final LocalAffinityOrAntiAffinityRuleKey other = (LocalAffinityOrAntiAffinityRuleKey) obj; + if (!Objects.equals(_affinityType, other._affinityType)) { + return false; + } + if (!Objects.equals(_affinityScope, other._affinityScope)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(LocalAffinityOrAntiAffinityRuleKey.class); + CodeHelpers.appendValue(helper, "_affinityType", _affinityType); + CodeHelpers.appendValue(helper, "_affinityScope", _affinityScope); + return helper.toString(); + } + + @Override + public Object deserializeKey(String key, DeserializationContext ctxt) throws IOException { + // TODO Auto-generated method stub + return this.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/Nsd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/Nsd.java new file mode 100644 index 0000000000000000000000000000000000000000..215f675498d4186e04700732706c2518ce2187eb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/Nsd.java @@ -0,0 +1,52 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nfv; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The NSD information element is a deployment template whose instances are used + * the NFVO for the lifecycle management of NSs. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list nsd {
+ *   key id;
+ *   uses nsd;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nfv/nsd + * + *

To create instances of this class use {@link NsdBuilder}. + * @see NsdBuilder + * @see NsdKey + * + */ +public interface Nsd + extends + ChildOf, + Augmentable, + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("nsd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.Nsd.class; + } + + @Override + NsdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/NsdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/NsdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..82b08f0712326be7148c3923bbe911ff3c0ba844 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/NsdBuilder.java @@ -0,0 +1,790 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.DfKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.LifecycleManagementScript; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.LifecycleManagementScriptKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Sapd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.SapdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VirtualLinkDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VirtualLinkDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Vnffgd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VnffgdKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NsdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsdBuilder + * @see Builder + * + */ +public class NsdBuilder implements Builder { + + private String _algorithm; + private List _autoscaleRule; + private String _certificate; + private String _designer; + private Map _df; + private String _id; + private String _invariantId; + private Map _lifecycleManagementScript; + private String _name; + private List _nestedNsdId; + private List _pnfdId; + private Map _sapd; + private String _signature; + private String _version; + private Map _virtualLinkDesc; + private List _vnfdId; + private Map _vnffgd; + private NsdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsdBuilder() { + } + public NsdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd arg) { + this._id = arg.getId(); + this._designer = arg.getDesigner(); + this._version = arg.getVersion(); + this._name = arg.getName(); + this._invariantId = arg.getInvariantId(); + this._nestedNsdId = arg.getNestedNsdId(); + this._vnfdId = arg.getVnfdId(); + this._pnfdId = arg.getPnfdId(); + this._sapd = arg.getSapd(); + this._virtualLinkDesc = arg.getVirtualLinkDesc(); + this._vnffgd = arg.getVnffgd(); + this._autoscaleRule = arg.getAutoscaleRule(); + this._lifecycleManagementScript = arg.getLifecycleManagementScript(); + this._df = arg.getDf(); + this._signature = arg.getSignature(); + this._algorithm = arg.getAlgorithm(); + this._certificate = arg.getCertificate(); + } + public NsdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters arg) { + this._signature = arg.getSignature(); + this._algorithm = arg.getAlgorithm(); + this._certificate = arg.getCertificate(); + } + + public NsdBuilder(Nsd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._algorithm = base.getAlgorithm(); + this._autoscaleRule = base.getAutoscaleRule(); + this._certificate = base.getCertificate(); + this._designer = base.getDesigner(); + this._df = base.getDf(); + this._invariantId = base.getInvariantId(); + this._lifecycleManagementScript = base.getLifecycleManagementScript(); + this._name = base.getName(); + this._nestedNsdId = base.getNestedNsdId(); + this._pnfdId = base.getPnfdId(); + this._sapd = base.getSapd(); + this._signature = base.getSignature(); + this._version = base.getVersion(); + this._virtualLinkDesc = base.getVirtualLinkDesc(); + this._vnfdId = base.getVnfdId(); + this._vnffgd = base.getVnffgd(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd) { + this._id = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getId(); + this._designer = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getDesigner(); + this._version = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getVersion(); + this._name = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getName(); + this._invariantId = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getInvariantId(); + this._nestedNsdId = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getNestedNsdId(); + this._vnfdId = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getVnfdId(); + this._pnfdId = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getPnfdId(); + this._sapd = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getSapd(); + this._virtualLinkDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getVirtualLinkDesc(); + this._vnffgd = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getVnffgd(); + this._autoscaleRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getAutoscaleRule(); + this._lifecycleManagementScript = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getLifecycleManagementScript(); + this._df = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getDf(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters) { + this._signature = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getSignature(); + this._algorithm = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getAlgorithm(); + this._certificate = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getCertificate(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd, org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters]"); + } + + public NsdKey key() { + return key; + } + + public String getAlgorithm() { + return _algorithm; + } + + public List getAutoscaleRule() { + return _autoscaleRule; + } + + public String getCertificate() { + return _certificate; + } + + public String getDesigner() { + return _designer; + } + + public Map getDf() { + return _df; + } + + public String getId() { + return _id; + } + + public String getInvariantId() { + return _invariantId; + } + + public Map getLifecycleManagementScript() { + return _lifecycleManagementScript; + } + + public String getName() { + return _name; + } + + public List getNestedNsdId() { + return _nestedNsdId; + } + + public List getPnfdId() { + return _pnfdId; + } + + public Map getSapd() { + return _sapd; + } + + public String getSignature() { + return _signature; + } + + public String getVersion() { + return _version; + } + + public Map getVirtualLinkDesc() { + return _virtualLinkDesc; + } + + public List getVnfdId() { + return _vnfdId; + } + + public Map getVnffgd() { + return _vnffgd; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public NsdBuilder withKey(final NsdKey key) { + this.key = key; + return this; + } + + public NsdBuilder setAlgorithm(final String value) { + this._algorithm = value; + return this; + } + public NsdBuilder setAutoscaleRule(final List values) { + this._autoscaleRule = values; + return this; + } + + + public NsdBuilder setCertificate(final String value) { + this._certificate = value; + return this; + } + + public NsdBuilder setDesigner(final String value) { + this._designer = value; + return this; + } + public NsdBuilder setDf(final Map values) { + this._df = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setDf(Map)} instead. + */ + @Deprecated(forRemoval = true) + @JsonIgnore + public NsdBuilder setDf(final List values) { + return setDf(CodeHelpers.compatMap(values)); + } + + public NsdBuilder setId(final String value) { + this._id = value; + return this; + } + + public NsdBuilder setInvariantId(final String value) { + this._invariantId = value; + return this; + } + public NsdBuilder setLifecycleManagementScript(final Map values) { + this._lifecycleManagementScript = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setLifecycleManagementScript(Map)} instead. + */ + @Deprecated(forRemoval = true) + @JsonIgnore + public NsdBuilder setLifecycleManagementScript(final List values) { + return setLifecycleManagementScript(CodeHelpers.compatMap(values)); + } + + public NsdBuilder setName(final String value) { + this._name = value; + return this; + } + public NsdBuilder setNestedNsdId(final List values) { + this._nestedNsdId = values; + return this; + } + + public NsdBuilder setPnfdId(final List values) { + this._pnfdId = values; + return this; + } + + public NsdBuilder setSapd(final Map values) { + this._sapd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSapd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder setSapd(final List values) { + return setSapd(CodeHelpers.compatMap(values)); + } + + public NsdBuilder setSignature(final String value) { + this._signature = value; + return this; + } + + public NsdBuilder setVersion(final String value) { + this._version = value; + return this; + } + public NsdBuilder setVirtualLinkDesc(final Map values) { + this._virtualLinkDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualLinkDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder setVirtualLinkDesc(final List values) { + return setVirtualLinkDesc(CodeHelpers.compatMap(values)); + } + public NsdBuilder setVnfdId(final List values) { + this._vnfdId = values; + return this; + } + + public NsdBuilder setVnffgd(final Map values) { + this._vnffgd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVnffgd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder setVnffgd(final List values) { + return setVnffgd(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Nsd build() { + return new NsdImpl(this); + } + + public static final class NsdImpl + extends AbstractAugmentable + implements Nsd { + + private final String _algorithm; + private final List _autoscaleRule; + private final String _certificate; + private final String _designer; + private Map _df; + @JsonProperty("id") + private final String _id; + @JsonProperty("_id") + private final String _invariantId; + private final Map _lifecycleManagementScript; + @JsonProperty("name") + private final String _name; + private final List _nestedNsdId; + private final List _pnfdId; + private final Map _sapd; + private final String _signature; + @JsonProperty("version") + private final String _version; + private final Map _virtualLinkDesc; + @JsonProperty("vnfd-id") + private final List _vnfdId; + private final Map _vnffgd; + private final NsdKey key; + + NsdImpl(NsdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new NsdKey(base.getId()); + } + this._id = key.getId(); + this._algorithm = base.getAlgorithm(); + this._autoscaleRule = base.getAutoscaleRule(); + this._certificate = base.getCertificate(); + this._designer = base.getDesigner(); + this._df = CodeHelpers.emptyToNull(base.getDf()); + this._invariantId = base.getInvariantId(); + this._lifecycleManagementScript = CodeHelpers.emptyToNull(base.getLifecycleManagementScript()); + this._name = base.getName(); + this._nestedNsdId = base.getNestedNsdId(); + this._pnfdId = base.getPnfdId(); + this._sapd = CodeHelpers.emptyToNull(base.getSapd()); + this._signature = base.getSignature(); + this._version = base.getVersion(); + this._virtualLinkDesc = CodeHelpers.emptyToNull(base.getVirtualLinkDesc()); + this._vnfdId = base.getVnfdId(); + this._vnffgd = CodeHelpers.emptyToNull(base.getVnffgd()); + } + + public NsdImpl(){ + this( new NsdBuilder() ); + } + + @Override + public NsdKey key() { + return key; + } + + @Override + public String getAlgorithm() { + return _algorithm; + } + + @Override + public List getAutoscaleRule() { + return _autoscaleRule; + } + + @Override + public String getCertificate() { + return _certificate; + } + + @Override + public String getDesigner() { + return _designer; + } + + public Map setDf(final List values) { + return _df = CodeHelpers.compatMap(values) ; + } + + @Override + public Map getDf() { + return _df; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getInvariantId() { + return _invariantId; + } + + @Override + public Map getLifecycleManagementScript() { + return _lifecycleManagementScript; + } + + @Override + public String getName() { + return _name; + } + + @Override + public List getNestedNsdId() { + return _nestedNsdId; + } + + @Override + public List getPnfdId() { + return _pnfdId; + } + + @Override + public Map getSapd() { + return _sapd; + } + + @Override + public String getSignature() { + return _signature; + } + + @Override + public String getVersion() { + return _version; + } + + @Override + public Map getVirtualLinkDesc() { + return _virtualLinkDesc; + } + + @Override + public List getVnfdId() { + return _vnfdId; + } + + @Override + public Map getVnffgd() { + return _vnffgd; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_algorithm); + result = prime * result + Objects.hashCode(_autoscaleRule); + result = prime * result + Objects.hashCode(_certificate); + result = prime * result + Objects.hashCode(_designer); + result = prime * result + Objects.hashCode(_df); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_invariantId); + result = prime * result + Objects.hashCode(_lifecycleManagementScript); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_nestedNsdId); + result = prime * result + Objects.hashCode(_pnfdId); + result = prime * result + Objects.hashCode(_sapd); + result = prime * result + Objects.hashCode(_signature); + result = prime * result + Objects.hashCode(_version); + result = prime * result + Objects.hashCode(_virtualLinkDesc); + result = prime * result + Objects.hashCode(_vnfdId); + result = prime * result + Objects.hashCode(_vnffgd); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Nsd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Nsd other = (Nsd)obj; + if (!Objects.equals(_algorithm, other.getAlgorithm())) { + return false; + } + if (!Objects.equals(_autoscaleRule, other.getAutoscaleRule())) { + return false; + } + if (!Objects.equals(_certificate, other.getCertificate())) { + return false; + } + if (!Objects.equals(_designer, other.getDesigner())) { + return false; + } + if (!Objects.equals(_df, other.getDf())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_invariantId, other.getInvariantId())) { + return false; + } + if (!Objects.equals(_lifecycleManagementScript, other.getLifecycleManagementScript())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_nestedNsdId, other.getNestedNsdId())) { + return false; + } + if (!Objects.equals(_pnfdId, other.getPnfdId())) { + return false; + } + if (!Objects.equals(_sapd, other.getSapd())) { + return false; + } + if (!Objects.equals(_signature, other.getSignature())) { + return false; + } + if (!Objects.equals(_version, other.getVersion())) { + return false; + } + if (!Objects.equals(_virtualLinkDesc, other.getVirtualLinkDesc())) { + return false; + } + if (!Objects.equals(_vnfdId, other.getVnfdId())) { + return false; + } + if (!Objects.equals(_vnffgd, other.getVnffgd())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsdImpl otherImpl = (NsdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Nsd"); + CodeHelpers.appendValue(helper, "_algorithm", _algorithm); + CodeHelpers.appendValue(helper, "_autoscaleRule", _autoscaleRule); + CodeHelpers.appendValue(helper, "_certificate", _certificate); + CodeHelpers.appendValue(helper, "_designer", _designer); + CodeHelpers.appendValue(helper, "_df", _df); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_invariantId", _invariantId); + CodeHelpers.appendValue(helper, "_lifecycleManagementScript", _lifecycleManagementScript); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_nestedNsdId", _nestedNsdId); + CodeHelpers.appendValue(helper, "_pnfdId", _pnfdId); + CodeHelpers.appendValue(helper, "_sapd", _sapd); + CodeHelpers.appendValue(helper, "_signature", _signature); + CodeHelpers.appendValue(helper, "_version", _version); + CodeHelpers.appendValue(helper, "_virtualLinkDesc", _virtualLinkDesc); + CodeHelpers.appendValue(helper, "_vnfdId", _vnfdId); + CodeHelpers.appendValue(helper, "_vnffgd", _vnffgd); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/NsdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/NsdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..06a1f066ceb03506a4e349228f5ed7db30ade045 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/NsdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class NsdKey + implements Identifier { + private static final long serialVersionUID = 8060294317279421094L; + private final String _id; + + + public NsdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public NsdKey(NsdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof NsdKey)) { + return false; + } + final NsdKey other = (NsdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(NsdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/Pnfd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/Pnfd.java new file mode 100644 index 0000000000000000000000000000000000000000..9cb3d8a7d756cb01b3a34ed7e3907a66314ff03e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/Pnfd.java @@ -0,0 +1,52 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nfv; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The Pnfd information element is a deployment template enabling on-boarding PNFs + * and referencing them from an NSD. It focuses on connectivity aspects only. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list pnfd {
+ *   key id;
+ *   uses pnfd;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nfv/pnfd + * + *

To create instances of this class use {@link PnfdBuilder}. + * @see PnfdBuilder + * @see PnfdKey + * + */ +public interface Pnfd + extends + ChildOf, + Augmentable, + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pnfd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.Pnfd.class; + } + + @Override + PnfdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/PnfdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/PnfdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..ed925be5a9e70489d220b915c40941893911f135 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/PnfdBuilder.java @@ -0,0 +1,561 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.ExtCpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.ExtCpdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.Security; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.SecurityKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRuleKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PnfdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PnfdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PnfdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PnfdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PnfdBuilder + * @see Builder + * + */ +public class PnfdBuilder implements Builder { + + private Map _extCpd; + private String _functionDescription; + private String _geographicalLocationInfo; + private String _id; + private String _invariantId; + private String _name; + private String _provider; + private Map _security; + private Map _securityGroupRule; + private String _version; + private PnfdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PnfdBuilder() { + } + public PnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd arg) { + this._id = arg.getId(); + this._functionDescription = arg.getFunctionDescription(); + this._provider = arg.getProvider(); + this._version = arg.getVersion(); + this._invariantId = arg.getInvariantId(); + this._name = arg.getName(); + this._extCpd = arg.getExtCpd(); + this._security = arg.getSecurity(); + this._geographicalLocationInfo = arg.getGeographicalLocationInfo(); + this._securityGroupRule = arg.getSecurityGroupRule(); + } + public PnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule arg) { + this._securityGroupRule = arg.getSecurityGroupRule(); + } + + public PnfdBuilder(Pnfd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._extCpd = base.getExtCpd(); + this._functionDescription = base.getFunctionDescription(); + this._geographicalLocationInfo = base.getGeographicalLocationInfo(); + this._invariantId = base.getInvariantId(); + this._name = base.getName(); + this._provider = base.getProvider(); + this._security = base.getSecurity(); + this._securityGroupRule = base.getSecurityGroupRule(); + this._version = base.getVersion(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule) { + this._securityGroupRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule)arg).getSecurityGroupRule(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd) { + this._id = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getId(); + this._functionDescription = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getFunctionDescription(); + this._provider = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getProvider(); + this._version = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getVersion(); + this._invariantId = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getInvariantId(); + this._name = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getName(); + this._extCpd = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getExtCpd(); + this._security = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getSecurity(); + this._geographicalLocationInfo = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getGeographicalLocationInfo(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule, org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd]"); + } + + public PnfdKey key() { + return key; + } + + public Map getExtCpd() { + return _extCpd; + } + + public String getFunctionDescription() { + return _functionDescription; + } + + public String getGeographicalLocationInfo() { + return _geographicalLocationInfo; + } + + public String getId() { + return _id; + } + + public String getInvariantId() { + return _invariantId; + } + + public String getName() { + return _name; + } + + public String getProvider() { + return _provider; + } + + public Map getSecurity() { + return _security; + } + + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + public String getVersion() { + return _version; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public PnfdBuilder withKey(final PnfdKey key) { + this.key = key; + return this; + } + public PnfdBuilder setExtCpd(final Map values) { + this._extCpd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setExtCpd(Map)} instead. + */ + @Deprecated(forRemoval = true) + @JsonIgnore + public PnfdBuilder setExtCpd(final List values) { + return setExtCpd(CodeHelpers.compatMap(values)); + } + + public PnfdBuilder setFunctionDescription(final String value) { + this._functionDescription = value; + return this; + } + + public PnfdBuilder setGeographicalLocationInfo(final String value) { + this._geographicalLocationInfo = value; + return this; + } + + public PnfdBuilder setId(final String value) { + this._id = value; + return this; + } + + public PnfdBuilder setInvariantId(final String value) { + this._invariantId = value; + return this; + } + + public PnfdBuilder setName(final String value) { + this._name = value; + return this; + } + + public PnfdBuilder setProvider(final String value) { + this._provider = value; + return this; + } + public PnfdBuilder setSecurity(final Map values) { + this._security = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSecurity(Map)} instead. + */ + @Deprecated(forRemoval = true) + public PnfdBuilder setSecurity(final List values) { + return setSecurity(CodeHelpers.compatMap(values)); + } + public PnfdBuilder setSecurityGroupRule(final Map values) { + this._securityGroupRule = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSecurityGroupRule(Map)} instead. + */ + @Deprecated(forRemoval = true) + @JsonIgnore + public PnfdBuilder setSecurityGroupRule(final List values) { + return setSecurityGroupRule(CodeHelpers.compatMap(values)); + } + + public PnfdBuilder setVersion(final String value) { + this._version = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PnfdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PnfdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PnfdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PnfdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Pnfd build() { + return new PnfdImpl(this); + } + + private static final class PnfdImpl + extends AbstractAugmentable + implements Pnfd { + + private final Map _extCpd; + private final String _functionDescription; + private final String _geographicalLocationInfo; + private final String _id; + private final String _invariantId; + private final String _name; + private final String _provider; + private final Map _security; + private final Map _securityGroupRule; + private final String _version; + private final PnfdKey key; + + PnfdImpl(PnfdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new PnfdKey(base.getId()); + } + this._id = key.getId(); + this._extCpd = CodeHelpers.emptyToNull(base.getExtCpd()); + this._functionDescription = base.getFunctionDescription(); + this._geographicalLocationInfo = base.getGeographicalLocationInfo(); + this._invariantId = base.getInvariantId(); + this._name = base.getName(); + this._provider = base.getProvider(); + this._security = CodeHelpers.emptyToNull(base.getSecurity()); + this._securityGroupRule = CodeHelpers.emptyToNull(base.getSecurityGroupRule()); + this._version = base.getVersion(); + } + + @Override + public PnfdKey key() { + return key; + } + + @Override + public Map getExtCpd() { + return _extCpd; + } + + @Override + public String getFunctionDescription() { + return _functionDescription; + } + + @Override + public String getGeographicalLocationInfo() { + return _geographicalLocationInfo; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getInvariantId() { + return _invariantId; + } + + @Override + public String getName() { + return _name; + } + + @Override + public String getProvider() { + return _provider; + } + + @Override + public Map getSecurity() { + return _security; + } + + @Override + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + @Override + public String getVersion() { + return _version; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_extCpd); + result = prime * result + Objects.hashCode(_functionDescription); + result = prime * result + Objects.hashCode(_geographicalLocationInfo); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_invariantId); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_provider); + result = prime * result + Objects.hashCode(_security); + result = prime * result + Objects.hashCode(_securityGroupRule); + result = prime * result + Objects.hashCode(_version); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Pnfd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Pnfd other = (Pnfd)obj; + if (!Objects.equals(_extCpd, other.getExtCpd())) { + return false; + } + if (!Objects.equals(_functionDescription, other.getFunctionDescription())) { + return false; + } + if (!Objects.equals(_geographicalLocationInfo, other.getGeographicalLocationInfo())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_invariantId, other.getInvariantId())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_provider, other.getProvider())) { + return false; + } + if (!Objects.equals(_security, other.getSecurity())) { + return false; + } + if (!Objects.equals(_securityGroupRule, other.getSecurityGroupRule())) { + return false; + } + if (!Objects.equals(_version, other.getVersion())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PnfdImpl otherImpl = (PnfdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Pnfd"); + CodeHelpers.appendValue(helper, "_extCpd", _extCpd); + CodeHelpers.appendValue(helper, "_functionDescription", _functionDescription); + CodeHelpers.appendValue(helper, "_geographicalLocationInfo", _geographicalLocationInfo); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_invariantId", _invariantId); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_provider", _provider); + CodeHelpers.appendValue(helper, "_security", _security); + CodeHelpers.appendValue(helper, "_securityGroupRule", _securityGroupRule); + CodeHelpers.appendValue(helper, "_version", _version); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/PnfdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/PnfdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..14e61d34a7fd9e795678b4113d649c5e7681fc42 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/PnfdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class PnfdKey + implements Identifier { + private static final long serialVersionUID = -6839690951618085740L; + private final String _id; + + + public PnfdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public PnfdKey(PnfdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof PnfdKey)) { + return false; + } + final PnfdKey other = (PnfdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(PnfdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/Vnfd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/Vnfd.java new file mode 100644 index 0000000000000000000000000000000000000000..61359990673cf5989998170bddd54da59901b777 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/Vnfd.java @@ -0,0 +1,57 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nfv; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.VnfdBuilder.VnfdImpl; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * A VNF Descriptor (VNFD) is a deployment template which describes a VNF in terms + * of deployment and operational behaviour requirements. It also contains + * connectivity, interface and virtualised resource requirements + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list vnfd {
+ *   key id;
+ *   uses vnfd;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nfv/vnfd + * + *

To create instances of this class use {@link VnfdBuilder}. + * @see VnfdBuilder + * @see VnfdKey + * + */ +public interface Vnfd + extends + ChildOf, + Augmentable, + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnfd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.Vnfd.class; + } + + @Override + VnfdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/VnfdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/VnfdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..d173c365b2cf2bcf914fe8775865c006f6b02cd4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/VnfdBuilder.java @@ -0,0 +1,1096 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRuleKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ConfigurableProperties; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.DfKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ElementGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ElementGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ExtCpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ExtCpdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Indicator; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IndicatorKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IntVirtualLinkDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IntVirtualLinkDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.LifecycleManagementScript; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.LifecycleManagementScriptKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ModifiableAttributes; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VduKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDescKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VnfdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfdBuilder + * @see Builder + * + */ +public class VnfdBuilder implements Builder { + + private List _autoScale; + private ConfigurableProperties _configurableProperties; + private String _defaultLocalizationLanguage; + private Map _df; + private Map _elementGroup; + private Map _extCpd; + private String _id; + private Map _indicator; + private Map _intVirtualLinkDesc; + private Map _lifecycleManagementScript; + private String _localizationLanguage; + private ModifiableAttributes _modifiableAttributes; + private String _productInfoDescription; + private String _productInfoName; + private String _productName; + private String _provider; + private Map _securityGroupRule; + private String _softwareVersion; + private Map _swImageDesc; + private Map _vdu; + private String _version; + private Map _virtualComputeDesc; + private Map _virtualStorageDesc; + private List _vnfmInfo; + private VnfdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfdBuilder() { + } + public VnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd arg) { + this._id = arg.getId(); + this._provider = arg.getProvider(); + this._productName = arg.getProductName(); + this._softwareVersion = arg.getSoftwareVersion(); + this._version = arg.getVersion(); + this._productInfoName = arg.getProductInfoName(); + this._productInfoDescription = arg.getProductInfoDescription(); + this._vnfmInfo = arg.getVnfmInfo(); + this._localizationLanguage = arg.getLocalizationLanguage(); + this._defaultLocalizationLanguage = arg.getDefaultLocalizationLanguage(); + this._vdu = arg.getVdu(); + this._virtualComputeDesc = arg.getVirtualComputeDesc(); + this._virtualStorageDesc = arg.getVirtualStorageDesc(); + this._swImageDesc = arg.getSwImageDesc(); + this._intVirtualLinkDesc = arg.getIntVirtualLinkDesc(); + this._extCpd = arg.getExtCpd(); + this._df = arg.getDf(); + this._configurableProperties = arg.getConfigurableProperties(); + this._modifiableAttributes = arg.getModifiableAttributes(); + this._lifecycleManagementScript = arg.getLifecycleManagementScript(); + this._elementGroup = arg.getElementGroup(); + this._indicator = arg.getIndicator(); + this._autoScale = arg.getAutoScale(); + this._securityGroupRule = arg.getSecurityGroupRule(); + } + public VnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule arg) { + this._securityGroupRule = arg.getSecurityGroupRule(); + } + + public VnfdBuilder(Vnfd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._autoScale = base.getAutoScale(); + this._configurableProperties = base.getConfigurableProperties(); + this._defaultLocalizationLanguage = base.getDefaultLocalizationLanguage(); + this._df = base.getDf(); + this._elementGroup = base.getElementGroup(); + this._extCpd = base.getExtCpd(); + this._indicator = base.getIndicator(); + this._intVirtualLinkDesc = base.getIntVirtualLinkDesc(); + this._lifecycleManagementScript = base.getLifecycleManagementScript(); + this._localizationLanguage = base.getLocalizationLanguage(); + this._modifiableAttributes = base.getModifiableAttributes(); + this._productInfoDescription = base.getProductInfoDescription(); + this._productInfoName = base.getProductInfoName(); + this._productName = base.getProductName(); + this._provider = base.getProvider(); + this._securityGroupRule = base.getSecurityGroupRule(); + this._softwareVersion = base.getSoftwareVersion(); + this._swImageDesc = base.getSwImageDesc(); + this._vdu = base.getVdu(); + this._version = base.getVersion(); + this._virtualComputeDesc = base.getVirtualComputeDesc(); + this._virtualStorageDesc = base.getVirtualStorageDesc(); + this._vnfmInfo = base.getVnfmInfo(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule) { + this._securityGroupRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule)arg).getSecurityGroupRule(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd) { + this._id = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getId(); + this._provider = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProvider(); + this._productName = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProductName(); + this._softwareVersion = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getSoftwareVersion(); + this._version = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVersion(); + this._productInfoName = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProductInfoName(); + this._productInfoDescription = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProductInfoDescription(); + this._vnfmInfo = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVnfmInfo(); + this._localizationLanguage = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getLocalizationLanguage(); + this._defaultLocalizationLanguage = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getDefaultLocalizationLanguage(); + this._vdu = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVdu(); + this._virtualComputeDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVirtualComputeDesc(); + this._virtualStorageDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVirtualStorageDesc(); + this._swImageDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getSwImageDesc(); + this._intVirtualLinkDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getIntVirtualLinkDesc(); + this._extCpd = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getExtCpd(); + this._df = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getDf(); + this._configurableProperties = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getConfigurableProperties(); + this._modifiableAttributes = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getModifiableAttributes(); + this._lifecycleManagementScript = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getLifecycleManagementScript(); + this._elementGroup = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getElementGroup(); + this._indicator = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getIndicator(); + this._autoScale = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getAutoScale(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule, org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd]"); + } + + public VnfdKey key() { + return key; + } + + public List getAutoScale() { + return _autoScale; + } + + public ConfigurableProperties getConfigurableProperties() { + return _configurableProperties; + } + + public String getDefaultLocalizationLanguage() { + return _defaultLocalizationLanguage; + } + + public Map getDf() { + return _df; + } + + public Map getElementGroup() { + return _elementGroup; + } + + public Map getExtCpd() { + return _extCpd; + } + + public String getId() { + return _id; + } + + public Map getIndicator() { + return _indicator; + } + + public Map getIntVirtualLinkDesc() { + return _intVirtualLinkDesc; + } + + public Map getLifecycleManagementScript() { + return _lifecycleManagementScript; + } + + public String getLocalizationLanguage() { + return _localizationLanguage; + } + + public ModifiableAttributes getModifiableAttributes() { + return _modifiableAttributes; + } + + public String getProductInfoDescription() { + return _productInfoDescription; + } + + public String getProductInfoName() { + return _productInfoName; + } + + public String getProductName() { + return _productName; + } + + public String getProvider() { + return _provider; + } + + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + public String getSoftwareVersion() { + return _softwareVersion; + } + + public Map getSwImageDesc() { + return _swImageDesc; + } + + public Map getVdu() { + return _vdu; + } + + public String getVersion() { + return _version; + } + + public Map getVirtualComputeDesc() { + return _virtualComputeDesc; + } + + public Map getVirtualStorageDesc() { + return _virtualStorageDesc; + } + + public List getVnfmInfo() { + return _vnfmInfo; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VnfdBuilder withKey(final VnfdKey key) { + this.key = key; + return this; + } + public VnfdBuilder setAutoScale(final List values) { + this._autoScale = values; + return this; + } + + + public VnfdBuilder setConfigurableProperties(final ConfigurableProperties value) { + this._configurableProperties = value; + return this; + } + + public VnfdBuilder setDefaultLocalizationLanguage(final String value) { + this._defaultLocalizationLanguage = value; + return this; + } + public VnfdBuilder setDf(final Map values) { + this._df = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setDf(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setDf(final List values) { + return setDf(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setElementGroup(final Map values) { + this._elementGroup = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setElementGroup(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setElementGroup(final List values) { + return setElementGroup(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setExtCpd(final Map values) { + this._extCpd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setExtCpd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setExtCpd(final List values) { + return setExtCpd(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setIndicator(final Map values) { + this._indicator = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setIndicator(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setIndicator(final List values) { + return setIndicator(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setIntVirtualLinkDesc(final Map values) { + this._intVirtualLinkDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setIntVirtualLinkDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setIntVirtualLinkDesc(final List values) { + return setIntVirtualLinkDesc(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setLifecycleManagementScript(final Map values) { + this._lifecycleManagementScript = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setLifecycleManagementScript(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setLifecycleManagementScript(final List values) { + return setLifecycleManagementScript(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setLocalizationLanguage(final String value) { + this._localizationLanguage = value; + return this; + } + + public VnfdBuilder setModifiableAttributes(final ModifiableAttributes value) { + this._modifiableAttributes = value; + return this; + } + + public VnfdBuilder setProductInfoDescription(final String value) { + this._productInfoDescription = value; + return this; + } + + public VnfdBuilder setProductInfoName(final String value) { + this._productInfoName = value; + return this; + } + + public VnfdBuilder setProductName(final String value) { + this._productName = value; + return this; + } + + public VnfdBuilder setProvider(final String value) { + this._provider = value; + return this; + } + public VnfdBuilder setSecurityGroupRule(final Map values) { + this._securityGroupRule = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSecurityGroupRule(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setSecurityGroupRule(final List values) { + return setSecurityGroupRule(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setSoftwareVersion(final String value) { + this._softwareVersion = value; + return this; + } + public VnfdBuilder setSwImageDesc(final Map values) { + this._swImageDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSwImageDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setSwImageDesc(final List values) { + return setSwImageDesc(CodeHelpers.compatMap(values)); + } + @JsonSetter("vdu") + public VnfdBuilder setVdu(final Map values) { + this._vdu = values; + return this; + } + + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVdu(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setVdu(final List values) { + return setVdu(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setVersion(final String value) { + this._version = value; + return this; + } + + @JsonSetter("virtual-compute-desc") + public VnfdBuilder setVirtualComputeDesc(final Map values) { + this._virtualComputeDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualComputeDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setVirtualComputeDesc(final List values) { + return setVirtualComputeDesc(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setVirtualStorageDesc(final Map values) { + this._virtualStorageDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualStorageDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setVirtualStorageDesc(final List values) { + return setVirtualStorageDesc(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setVnfmInfo(final List values) { + this._vnfmInfo = values; + return this; + } + + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Vnfd build() { + return new VnfdImpl(this); + } + + public static final class VnfdImpl + extends AbstractAugmentable + implements Vnfd { + + private final List _autoScale; + private final ConfigurableProperties _configurableProperties; + private final String _defaultLocalizationLanguage; + private Map _df; + private final Map _elementGroup; + private final Map _extCpd; + @JsonProperty("_id") + private final String _id; + private final Map _indicator; + private final Map _intVirtualLinkDesc; + private final Map _lifecycleManagementScript; + private final String _localizationLanguage; + private final ModifiableAttributes _modifiableAttributes; + @JsonProperty("product-info-description") + private final String _productInfoDescription; + private final String _productInfoName; + @JsonProperty("product-name") + private final String _productName; + @JsonProperty("provider") + private final String _provider; + private final Map _securityGroupRule; + private final String _softwareVersion; + private final Map _swImageDesc; + @JsonProperty("vdu") + private Map _vdu; + @JsonProperty("version") + private final String _version; + @JsonProperty("virtual-compute-desc") + private Map _virtualComputeDesc; + @JsonProperty("virtual-storage-desc") + private Map _virtualStorageDesc; + private final List _vnfmInfo; + private final VnfdKey key; + + VnfdImpl(VnfdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VnfdKey(base.getId()); + } + this._id = key.getId(); + this._autoScale = base.getAutoScale(); + this._configurableProperties = base.getConfigurableProperties(); + this._defaultLocalizationLanguage = base.getDefaultLocalizationLanguage(); + this._df = CodeHelpers.emptyToNull(base.getDf()); + this._elementGroup = CodeHelpers.emptyToNull(base.getElementGroup()); + this._extCpd = CodeHelpers.emptyToNull(base.getExtCpd()); + this._indicator = CodeHelpers.emptyToNull(base.getIndicator()); + this._intVirtualLinkDesc = CodeHelpers.emptyToNull(base.getIntVirtualLinkDesc()); + this._lifecycleManagementScript = CodeHelpers.emptyToNull(base.getLifecycleManagementScript()); + this._localizationLanguage = base.getLocalizationLanguage(); + this._modifiableAttributes = base.getModifiableAttributes(); + this._productInfoDescription = base.getProductInfoDescription(); + this._productInfoName = base.getProductInfoName(); + this._productName = base.getProductName(); + this._provider = base.getProvider(); + this._securityGroupRule = CodeHelpers.emptyToNull(base.getSecurityGroupRule()); + this._softwareVersion = base.getSoftwareVersion(); + this._swImageDesc = CodeHelpers.emptyToNull(base.getSwImageDesc()); + this._vdu = CodeHelpers.emptyToNull(base.getVdu()); + this._version = base.getVersion(); + this._virtualComputeDesc = CodeHelpers.emptyToNull(base.getVirtualComputeDesc()); + this._virtualStorageDesc = CodeHelpers.emptyToNull(base.getVirtualStorageDesc()); + this._vnfmInfo = base.getVnfmInfo(); + } + + public VnfdImpl(){ + this( new VnfdBuilder() ); + } + + @Override + public VnfdKey key() { + return key; + } + + @Override + public List getAutoScale() { + return _autoScale; + } + + @Override + public ConfigurableProperties getConfigurableProperties() { + return _configurableProperties; + } + + @Override + public String getDefaultLocalizationLanguage() { + return _defaultLocalizationLanguage; + } + + public Map setDf(final List values) { + return _df = CodeHelpers.compatMap(values) ; + } + + @Override + public Map getDf() { + return _df; + } + + @Override + public Map getElementGroup() { + return _elementGroup; + } + + @Override + public Map getExtCpd() { + return _extCpd; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getIndicator() { + return _indicator; + } + + @Override + public Map getIntVirtualLinkDesc() { + return _intVirtualLinkDesc; + } + + @Override + public Map getLifecycleManagementScript() { + return _lifecycleManagementScript; + } + + @Override + public String getLocalizationLanguage() { + return _localizationLanguage; + } + + @Override + public ModifiableAttributes getModifiableAttributes() { + return _modifiableAttributes; + } + + @Override + public String getProductInfoDescription() { + return _productInfoDescription; + } + + @Override + public String getProductInfoName() { + return _productInfoName; + } + + @Override + public String getProductName() { + return _productName; + } + + @Override + public String getProvider() { + return _provider; + } + + @Override + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + @Override + public String getSoftwareVersion() { + return _softwareVersion; + } + + @Override + public Map getSwImageDesc() { + return _swImageDesc; + } + + public Map setVdu(final List values) { + return _vdu = CodeHelpers.compatMap(values) ; + } + + @Override + public Map getVdu() { + return _vdu; + } + + @Override + public String getVersion() { + return _version; + } + + @Override + public Map getVirtualComputeDesc() { + return _virtualComputeDesc; + } + + @JsonSetter("virtual-compute-desc") + public Map setVirtualComputeDesc(final List values) { + return _virtualComputeDesc = CodeHelpers.compatMap(values) ; + } + + @Override + public Map getVirtualStorageDesc() { + return _virtualStorageDesc; + } + + @JsonSetter("virtual-storage-desc") + public Map setVirtualStorageDesc(final List values) { + return _virtualStorageDesc = CodeHelpers.compatMap(values) ; + } + + @Override + public List getVnfmInfo() { + return _vnfmInfo; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_autoScale); + result = prime * result + Objects.hashCode(_configurableProperties); + result = prime * result + Objects.hashCode(_defaultLocalizationLanguage); + result = prime * result + Objects.hashCode(_df); + result = prime * result + Objects.hashCode(_elementGroup); + result = prime * result + Objects.hashCode(_extCpd); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_indicator); + result = prime * result + Objects.hashCode(_intVirtualLinkDesc); + result = prime * result + Objects.hashCode(_lifecycleManagementScript); + result = prime * result + Objects.hashCode(_localizationLanguage); + result = prime * result + Objects.hashCode(_modifiableAttributes); + result = prime * result + Objects.hashCode(_productInfoDescription); + result = prime * result + Objects.hashCode(_productInfoName); + result = prime * result + Objects.hashCode(_productName); + result = prime * result + Objects.hashCode(_provider); + result = prime * result + Objects.hashCode(_securityGroupRule); + result = prime * result + Objects.hashCode(_softwareVersion); + result = prime * result + Objects.hashCode(_swImageDesc); + result = prime * result + Objects.hashCode(_vdu); + result = prime * result + Objects.hashCode(_version); + result = prime * result + Objects.hashCode(_virtualComputeDesc); + result = prime * result + Objects.hashCode(_virtualStorageDesc); + result = prime * result + Objects.hashCode(_vnfmInfo); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vnfd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vnfd other = (Vnfd)obj; + if (!Objects.equals(_autoScale, other.getAutoScale())) { + return false; + } + if (!Objects.equals(_configurableProperties, other.getConfigurableProperties())) { + return false; + } + if (!Objects.equals(_defaultLocalizationLanguage, other.getDefaultLocalizationLanguage())) { + return false; + } + if (!Objects.equals(_df, other.getDf())) { + return false; + } + if (!Objects.equals(_elementGroup, other.getElementGroup())) { + return false; + } + if (!Objects.equals(_extCpd, other.getExtCpd())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_indicator, other.getIndicator())) { + return false; + } + if (!Objects.equals(_intVirtualLinkDesc, other.getIntVirtualLinkDesc())) { + return false; + } + if (!Objects.equals(_lifecycleManagementScript, other.getLifecycleManagementScript())) { + return false; + } + if (!Objects.equals(_localizationLanguage, other.getLocalizationLanguage())) { + return false; + } + if (!Objects.equals(_modifiableAttributes, other.getModifiableAttributes())) { + return false; + } + if (!Objects.equals(_productInfoDescription, other.getProductInfoDescription())) { + return false; + } + if (!Objects.equals(_productInfoName, other.getProductInfoName())) { + return false; + } + if (!Objects.equals(_productName, other.getProductName())) { + return false; + } + if (!Objects.equals(_provider, other.getProvider())) { + return false; + } + if (!Objects.equals(_securityGroupRule, other.getSecurityGroupRule())) { + return false; + } + if (!Objects.equals(_softwareVersion, other.getSoftwareVersion())) { + return false; + } + if (!Objects.equals(_swImageDesc, other.getSwImageDesc())) { + return false; + } + if (!Objects.equals(_vdu, other.getVdu())) { + return false; + } + if (!Objects.equals(_version, other.getVersion())) { + return false; + } + if (!Objects.equals(_virtualComputeDesc, other.getVirtualComputeDesc())) { + return false; + } + if (!Objects.equals(_virtualStorageDesc, other.getVirtualStorageDesc())) { + return false; + } + if (!Objects.equals(_vnfmInfo, other.getVnfmInfo())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfdImpl otherImpl = (VnfdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vnfd"); + CodeHelpers.appendValue(helper, "_autoScale", _autoScale); + CodeHelpers.appendValue(helper, "_configurableProperties", _configurableProperties); + CodeHelpers.appendValue(helper, "_defaultLocalizationLanguage", _defaultLocalizationLanguage); + CodeHelpers.appendValue(helper, "_df", _df); + CodeHelpers.appendValue(helper, "_elementGroup", _elementGroup); + CodeHelpers.appendValue(helper, "_extCpd", _extCpd); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_indicator", _indicator); + CodeHelpers.appendValue(helper, "_intVirtualLinkDesc", _intVirtualLinkDesc); + CodeHelpers.appendValue(helper, "_lifecycleManagementScript", _lifecycleManagementScript); + CodeHelpers.appendValue(helper, "_localizationLanguage", _localizationLanguage); + CodeHelpers.appendValue(helper, "_modifiableAttributes", _modifiableAttributes); + CodeHelpers.appendValue(helper, "_productInfoDescription", _productInfoDescription); + CodeHelpers.appendValue(helper, "_productInfoName", _productInfoName); + CodeHelpers.appendValue(helper, "_productName", _productName); + CodeHelpers.appendValue(helper, "_provider", _provider); + CodeHelpers.appendValue(helper, "_securityGroupRule", _securityGroupRule); + CodeHelpers.appendValue(helper, "_softwareVersion", _softwareVersion); + CodeHelpers.appendValue(helper, "_swImageDesc", _swImageDesc); + CodeHelpers.appendValue(helper, "_vdu", _vdu); + CodeHelpers.appendValue(helper, "_version", _version); + CodeHelpers.appendValue(helper, "_virtualComputeDesc", _virtualComputeDesc); + CodeHelpers.appendValue(helper, "_virtualStorageDesc", _virtualStorageDesc); + CodeHelpers.appendValue(helper, "_vnfmInfo", _vnfmInfo); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/VnfdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/VnfdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..9f16c3a2ea028064c59f722918863b81106c2712 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nfv/VnfdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VnfdKey + implements Identifier { + private static final long serialVersionUID = -7003982558180291733L; + private final String _id; + + + public VnfdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VnfdKey(VnfdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VnfdKey)) { + return false; + } + final VnfdKey other = (VnfdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VnfdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/Df.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/Df.java new file mode 100644 index 0000000000000000000000000000000000000000..cecbb56bebb3dcd0d4927d976b9a3de8fc59935f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/Df.java @@ -0,0 +1,610 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.DfBuilder.DfImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.Dependencies; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.DependenciesKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.MonitoredInfo; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.MonitoredInfoKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsInstantiationLevel; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsInstantiationLevelKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsProfileKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.PnfProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.PnfProfileKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ScalingAspect; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ScalingAspectKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VirtualLinkProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VirtualLinkProfileKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VnfProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VnfProfileKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Identifies a DF within the scope of an NSD. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list df {
+ *   min-elements 1;
+ *   must "default-instantiation-level or count(ns-instantiation-level) = 1" {
+ *     error-message
+ *       "default-instantiation-level must be present if there multiple instantion-level";
+ *   }
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf flavour-key {
+ *     type leafref {
+ *       path ../monitored-info/id;
+ *     }
+ *   }
+ *   list vnf-profile {
+ *     must "min-number-of-instances <= max-number-of-instances";
+ *     must boolean(../../vnfd-id[.=current()/vnfd-id]) {
+ *       error-message
+ *         "VNFDs in the profile has to be listed as a dependency of the network service descriptor.";
+ *     }
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf vnfd-id {
+ *       type leafref {
+ *         path ../../../../vnfd/id;
+ *       }
+ *     }
+ *     leaf flavour-id {
+ *       type leafref {
+ *         path deref(../vnfd-id)/../df/id;
+ *       }
+ *     }
+ *     leaf instantiation-level {
+ *       type leafref {
+ *         path deref(../flavour-id)/../instantiation-level/id;
+ *       }
+ *     }
+ *     leaf min-number-of-instances {
+ *       default 1;
+ *       type uint16;
+ *     }
+ *     leaf max-number-of-instances {
+ *       default 1;
+ *       type uint16;
+ *     }
+ *     uses local-affinity-or-anti-affinity-rule;
+ *     list affinity-or-anti-affinity-group {
+ *       key id;
+ *       leaf id {
+ *         type leafref {
+ *           path ../../../affinity-or-anti-affinity-group/id;
+ *         }
+ *       }
+ *     }
+ *     list virtual-link-connectivity {
+ *       key virtual-link-profile-id;
+ *       leaf virtual-link-profile-id {
+ *         type leafref {
+ *           path ../../../virtual-link-profile/id;
+ *         }
+ *       }
+ *       list constituent-cpd-id {
+ *         key constituent-base-element-id;
+ *         leaf constituent-base-element-id {
+ *           type leafref {
+ *             path ../../../id;
+ *           }
+ *         }
+ *         leaf constituent-cpd-id {
+ *           type leafref {
+ *             path deref(../../../vnfd-id)/../ext-cpd/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ *   list pnf-profile {
+ *     key id;
+ *     must boolean(../../pnfd-id[.=current()/pnfd-id]) {
+ *       error-message
+ *         "PNFDs in the profile has to be listed as a dependency of the network service descriptor.";
+ *     }
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf pnfd-id {
+ *       type leafref {
+ *         path ../../../../pnfd/id;
+ *       }
+ *     }
+ *     list virtual-link-connectivity {
+ *       key virtual-link-profile-id;
+ *       leaf virtual-link-profile-id {
+ *         type leafref {
+ *           path ../../../virtual-link-profile/id;
+ *         }
+ *       }
+ *       list constituent-cpd-id {
+ *         key constituent-base-element-id;
+ *         leaf constituent-base-element-id {
+ *           type leafref {
+ *             path ../../../id;
+ *           }
+ *         }
+ *         leaf constituent-cpd-id {
+ *           type leafref {
+ *             path deref(../../../pnfd-id)/../ext-cpd/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ *   list virtual-link-profile {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf virtual-link-desc-id {
+ *       type leafref {
+ *         path ../../../virtual-link-desc/id;
+ *       }
+ *     }
+ *     leaf flavour-id {
+ *       type leafref {
+ *         path deref(../virtual-link-desc-id)/../df/id;
+ *       }
+ *     }
+ *     uses local-affinity-or-anti-affinity-rule;
+ *     list affinity-or-anti-affinity-group {
+ *       key id;
+ *       leaf id {
+ *         type leafref {
+ *           path ../../../affinity-or-anti-affinity-group/id;
+ *         }
+ *       }
+ *     }
+ *     container max-bitrate-requirements {
+ *       uses link-bitrate-requirements;
+ *     }
+ *     container min-bitrate-requirements {
+ *       uses link-bitrate-requirements;
+ *     }
+ *   }
+ *   list scaling-aspect {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     leaf scaling-level {
+ *       type leafref {
+ *         path ../../ns-instantiation-level/id;
+ *       }
+ *     }
+ *   }
+ *   list affinity-or-anti-affinity-group {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf type {
+ *       type affinity-type;
+ *     }
+ *     leaf scope {
+ *       type affinity-scope;
+ *     }
+ *   }
+ *   list ns-instantiation-level {
+ *     min-elements 1;
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     list vnf-to-level-mapping {
+ *       key vnf-profile-id;
+ *       leaf vnf-profile-id {
+ *         type leafref {
+ *           path ../../../vnf-profile/id;
+ *         }
+ *       }
+ *       leaf number-of-instances {
+ *         default 1;
+ *         type uint32;
+ *       }
+ *     }
+ *     list virtual-link-to-level-mapping {
+ *       key virtual-link-profile-id;
+ *       leaf virtual-link-profile-id {
+ *         type leafref {
+ *           path ../../../virtual-link-profile/id;
+ *         }
+ *       }
+ *       uses link-bitrate-requirements;
+ *     }
+ *     list ns-to-level-mapping {
+ *       key ns-profile-id;
+ *       leaf ns-profile-id {
+ *         type leafref {
+ *           path ../../../ns-profile/id;
+ *         }
+ *       }
+ *       leaf number-of-instances {
+ *         default 1;
+ *         type uint32;
+ *       }
+ *     }
+ *     must "(count(vnf-to-level-mapping) + count(virtual-link-to-level-mapping) + count(ns-to-level-mapping)) > 0" {
+ *       error-message
+ *         "At least one attribute between vnf-to-level-mapping, virtual-link-to-level-mapping and ns-to-level-mapping shall be present.";
+ *     }
+ *   }
+ *   leaf default-instantiation-level {
+ *     type leafref {
+ *       path ../ns-instantiation-level/id;
+ *     }
+ *   }
+ *   list ns-profile {
+ *     must "min-number-of-instances <= max-number-of-instances" {
+ *       error-message
+ *         "min-number-of-instances has to be less than or equalmax-number-of-instances.";
+ *     }
+ *     must boolean(../../nested-nsd-id[.=current()/nsd-id]) {
+ *       error-message
+ *         "PNFDs in the profile has to be listed as a dependency of the network service descriptor.";
+ *     }
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf nsd-id {
+ *       type leafref {
+ *         path ../../../../nsd/id;
+ *       }
+ *     }
+ *     leaf ns-df-id {
+ *       type leafref {
+ *         path deref(../nsd-id)/../df/id;
+ *       }
+ *     }
+ *     leaf instantiation-level-id {
+ *       type leafref {
+ *         path deref(../ns-df-id)/../ns-instantiation-level/id;
+ *       }
+ *     }
+ *     leaf min-number-of-instances {
+ *       type uint16;
+ *       default 1;
+ *     }
+ *     leaf max-number-of-instances {
+ *       type uint16;
+ *       default 1;
+ *     }
+ *     list affinity-or-anti-affinity-group-id {
+ *       key id;
+ *       leaf id {
+ *         type leafref {
+ *           path ../../../affinity-or-anti-affinity-group/id;
+ *         }
+ *       }
+ *     }
+ *     list virtual-link-connectivity {
+ *       key virtual-link-profile-id;
+ *       leaf virtual-link-profile-id {
+ *         type leafref {
+ *           path ../../../virtual-link-profile/id;
+ *         }
+ *       }
+ *       list constituent-cpd-id {
+ *         key constituent-base-element-id;
+ *         leaf constituent-base-element-id {
+ *           type leafref {
+ *             path ../../../id;
+ *           }
+ *         }
+ *         leaf constituent-cpd-id {
+ *           type leafref {
+ *             path deref(../../../nsd-id)/../sapd/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ *   list dependencies {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     choice primary-id {
+ *       case primary-vnf-profile {
+ *         leaf primary-vnf-profile {
+ *           type leafref {
+ *             path ../../vnf-profile/vnfd-id;
+ *           }
+ *         }
+ *       }
+ *       case primary-ns-profile {
+ *         leaf primary-ns-profile {
+ *           type leafref {
+ *             path ../../ns-profile/nsd-id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     choice secondary-id {
+ *       case secondary-vnf-profile {
+ *         leaf secondary-vnf-profile {
+ *           type leafref {
+ *             path ../../vnf-profile/vnfd-id;
+ *           }
+ *         }
+ *       }
+ *       case secondary-ns-profile {
+ *         leaf secondary-ns-profile {
+ *           type leafref {
+ *             path ../../ns-profile/nsd-id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ *   list monitored-info {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     container vnf-indicator-info {
+ *       leaf vnfd-id {
+ *         type leafref {
+ *           path ../../../../../vnfd/id;
+ *         }
+ *       }
+ *       leaf vnf-indicator {
+ *         type leafref {
+ *           path deref(../vnfd-id)/../indicator/id;
+ *         }
+ *       }
+ *     }
+ *     container monitoring-parameter {
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf name {
+ *         type string;
+ *       }
+ *       leaf performance-metric {
+ *         type string;
+ *       }
+ *       leaf collection-period {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df + * + *

To create instances of this class use {@link DfBuilder}. + * @see DfBuilder + * @see DfKey + * + */ +@JsonDeserialize(as = DfImpl.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public interface Df + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("df"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df.class; + } + + /** + * Identifies this NsDf information element. It identifies a NS DF within the NSD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Assurance parameter against which this flavour is being described. The key can + * be a combination of multiple assurance parameters with a logical relationship + * between them. The parameters should be present as a monitoredInfo attribute in + * the NSD. + * + * + * + * @return java.lang.String flavourKey, or null if not present + */ + @Nullable String getFlavourKey(); + + /** + * VNF profile to be used for the NS flavour. + * + * + * + * @return java.util.Map vnfProfile, or null if not present + */ + @Nullable Map getVnfProfile(); + + /** + * @return java.util.Map vnfProfile, or an empty list if it is not present + */ + default @NonNull Map nonnullVnfProfile() { + return CodeHelpers.nonnull(getVnfProfile()); + } + + /** + * @return java.util.Map pnfProfile, or null if not present + */ + @Nullable Map getPnfProfile(); + + /** + * @return java.util.Map pnfProfile, or an empty list if it is not present + */ + default @NonNull Map nonnullPnfProfile() { + return CodeHelpers.nonnull(getPnfProfile()); + } + + /** + * VL profile to be used for the NS flavour. + * + * + * + * @return java.util.Map virtualLinkProfile, or null if not present + */ + @Nullable Map getVirtualLinkProfile(); + + /** + * @return java.util.Map virtualLinkProfile, or an empty list if it is not present + */ + default @NonNull Map nonnullVirtualLinkProfile() { + return CodeHelpers.nonnull(getVirtualLinkProfile()); + } + + /** + * The scaling aspects supported by this DF of the NS. + * + * + * + * @return java.util.Map scalingAspect, or null if not present + */ + @Nullable Map getScalingAspect(); + + /** + * @return java.util.Map scalingAspect, or an empty list if it is not present + */ + default @NonNull Map nonnullScalingAspect() { + return CodeHelpers.nonnull(getScalingAspect()); + } + + /** + * Specifies affinity or anti-affinity relationship applicable between the VNF + * instances created using different VNFDs, the Virtual Link instances created + * using different NsVirtualLinkDescs or the nested NS instances created using + * different NSDs in the same affinity or anti-affinity group. + * + * + * + * @return java.util.Map affinityOrAntiAffinityGroup, or null if not present + */ + @Nullable Map getAffinityOrAntiAffinityGroup(); + + /** + * @return java.util.Map affinityOrAntiAffinityGroup, or an empty list if it is not present + */ + default @NonNull Map nonnullAffinityOrAntiAffinityGroup() { + return CodeHelpers.nonnull(getAffinityOrAntiAffinityGroup()); + } + + /** + * Describes the details of an NS level. + * + * + * + * @return java.util.Map nsInstantiationLevel, or null if not present + */ + @Nullable Map getNsInstantiationLevel(); + + /** + * @return java.util.Map nsInstantiationLevel, or an empty list if it is not present + */ + default @NonNull Map nonnullNsInstantiationLevel() { + return CodeHelpers.nonnull(getNsInstantiationLevel()); + } + + /** + * Identifies the NS level which represents the default NS instantiation level for + * this DF. It shall be present if there are multiple 'nsIinstantiationLevel' + * entries. + * + * + * + * @return java.lang.String defaultInstantiationLevel, or null if not present + */ + @Nullable String getDefaultInstantiationLevel(); + + /** + * Specifies a NS Profile supported by this NS DF. + * + * + * + * @return java.util.Map nsProfile, or null if not present + */ + @Nullable Map getNsProfile(); + + /** + * @return java.util.Map nsProfile, or an empty list if it is not present + */ + default @NonNull Map nonnullNsProfile() { + return CodeHelpers.nonnull(getNsProfile()); + } + + /** + * Specifies the order in which instances of the VNFs and/or nested NSs have to be + * created. + * + * + * + * @return java.util.Map dependencies, or null if not present + */ + @Nullable Map getDependencies(); + + /** + * @return java.util.Map dependencies, or an empty list if it is not present + */ + default @NonNull Map nonnullDependencies() { + return CodeHelpers.nonnull(getDependencies()); + } + + /** + * @return java.util.Map monitoredInfo, or null if not present + */ + @Nullable Map getMonitoredInfo(); + + /** + * @return java.util.Map monitoredInfo, or an empty list if it is not present + */ + default @NonNull Map nonnullMonitoredInfo() { + return CodeHelpers.nonnull(getMonitoredInfo()); + } + + @Override + DfKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/DfBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/DfBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..5997986c2d5726f5e56e12c96d8038faea0d1a6e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/DfBuilder.java @@ -0,0 +1,705 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.Dependencies; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.DependenciesKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.MonitoredInfo; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.MonitoredInfoKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsInstantiationLevel; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsInstantiationLevelKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsProfileKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.PnfProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.PnfProfileKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ScalingAspect; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ScalingAspectKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VirtualLinkProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VirtualLinkProfileKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VnfProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VnfProfileBuilder.VnfProfileImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VnfProfileKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link DfBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     DfBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new DfBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of DfBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see DfBuilder + * @see Builder + * + */ +public class DfBuilder implements Builder { + + private Map _affinityOrAntiAffinityGroup; + private String _defaultInstantiationLevel; + private Map _dependencies; + private String _flavourKey; + private String _id; + private Map _monitoredInfo; + private Map _nsInstantiationLevel; + private Map _nsProfile; + private Map _pnfProfile; + private Map _scalingAspect; + private Map _virtualLinkProfile; + private Map _vnfProfile; + private DfKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public DfBuilder() { + } + + public DfBuilder(Df base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._affinityOrAntiAffinityGroup = base.getAffinityOrAntiAffinityGroup(); + this._defaultInstantiationLevel = base.getDefaultInstantiationLevel(); + this._dependencies = base.getDependencies(); + this._flavourKey = base.getFlavourKey(); + this._monitoredInfo = base.getMonitoredInfo(); + this._nsInstantiationLevel = base.getNsInstantiationLevel(); + this._nsProfile = base.getNsProfile(); + this._pnfProfile = base.getPnfProfile(); + this._scalingAspect = base.getScalingAspect(); + this._virtualLinkProfile = base.getVirtualLinkProfile(); + this._vnfProfile = base.getVnfProfile(); + } + + + public DfKey key() { + return key; + } + + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + public String getDefaultInstantiationLevel() { + return _defaultInstantiationLevel; + } + + public Map getDependencies() { + return _dependencies; + } + + public String getFlavourKey() { + return _flavourKey; + } + + public String getId() { + return _id; + } + + public Map getMonitoredInfo() { + return _monitoredInfo; + } + + public Map getNsInstantiationLevel() { + return _nsInstantiationLevel; + } + + public Map getNsProfile() { + return _nsProfile; + } + + public Map getPnfProfile() { + return _pnfProfile; + } + + public Map getScalingAspect() { + return _scalingAspect; + } + + public Map getVirtualLinkProfile() { + return _virtualLinkProfile; + } + + public Map getVnfProfile() { + return _vnfProfile; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public DfBuilder withKey(final DfKey key) { + this.key = key; + return this; + } + public DfBuilder setAffinityOrAntiAffinityGroup(final Map values) { + this._affinityOrAntiAffinityGroup = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setAffinityOrAntiAffinityGroup(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setAffinityOrAntiAffinityGroup(final List values) { + return setAffinityOrAntiAffinityGroup(CodeHelpers.compatMap(values)); + } + + public DfBuilder setDefaultInstantiationLevel(final String value) { + this._defaultInstantiationLevel = value; + return this; + } + public DfBuilder setDependencies(final Map values) { + this._dependencies = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setDependencies(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setDependencies(final List values) { + return setDependencies(CodeHelpers.compatMap(values)); + } + + public DfBuilder setFlavourKey(final String value) { + this._flavourKey = value; + return this; + } + + public DfBuilder setId(final String value) { + this._id = value; + return this; + } + public DfBuilder setMonitoredInfo(final Map values) { + this._monitoredInfo = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setMonitoredInfo(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setMonitoredInfo(final List values) { + return setMonitoredInfo(CodeHelpers.compatMap(values)); + } + public DfBuilder setNsInstantiationLevel(final Map values) { + this._nsInstantiationLevel = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setNsInstantiationLevel(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setNsInstantiationLevel(final List values) { + return setNsInstantiationLevel(CodeHelpers.compatMap(values)); + } + public DfBuilder setNsProfile(final Map values) { + this._nsProfile = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setNsProfile(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setNsProfile(final List values) { + return setNsProfile(CodeHelpers.compatMap(values)); + } + public DfBuilder setPnfProfile(final Map values) { + this._pnfProfile = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setPnfProfile(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setPnfProfile(final List values) { + return setPnfProfile(CodeHelpers.compatMap(values)); + } + public DfBuilder setScalingAspect(final Map values) { + this._scalingAspect = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setScalingAspect(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setScalingAspect(final List values) { + return setScalingAspect(CodeHelpers.compatMap(values)); + } + public DfBuilder setVirtualLinkProfile(final Map values) { + this._virtualLinkProfile = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualLinkProfile(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setVirtualLinkProfile(final List values) { + return setVirtualLinkProfile(CodeHelpers.compatMap(values)); + } + public DfBuilder setVnfProfile(final Map values) { + this._vnfProfile = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVnfProfile(Map)} instead. + */ + + @Deprecated(forRemoval = true) + public DfBuilder setVnfProfile(final List values) { + return setVnfProfile(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public DfBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public DfBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private DfBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Df build() { + return new DfImpl(this); + } + + public static final class DfImpl + extends AbstractAugmentable + implements Df { + + private final Map _affinityOrAntiAffinityGroup; + private final String _defaultInstantiationLevel; + private final Map _dependencies; + private final String _flavourKey; + @JsonProperty("id") + private final String _id; + private final Map _monitoredInfo; + private final Map _nsInstantiationLevel; + private final Map _nsProfile; + private final Map _pnfProfile; + private final Map _scalingAspect; + private final Map _virtualLinkProfile; + private Map _vnfProfile; + private final DfKey key; + + DfImpl(DfBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new DfKey(base.getId()); + } + this._id = key.getId(); + this._affinityOrAntiAffinityGroup = CodeHelpers.emptyToNull(base.getAffinityOrAntiAffinityGroup()); + this._defaultInstantiationLevel = base.getDefaultInstantiationLevel(); + this._dependencies = CodeHelpers.emptyToNull(base.getDependencies()); + this._flavourKey = base.getFlavourKey(); + this._monitoredInfo = CodeHelpers.emptyToNull(base.getMonitoredInfo()); + this._nsInstantiationLevel = CodeHelpers.emptyToNull(base.getNsInstantiationLevel()); + this._nsProfile = CodeHelpers.emptyToNull(base.getNsProfile()); + this._pnfProfile = CodeHelpers.emptyToNull(base.getPnfProfile()); + this._scalingAspect = CodeHelpers.emptyToNull(base.getScalingAspect()); + this._virtualLinkProfile = CodeHelpers.emptyToNull(base.getVirtualLinkProfile()); + this._vnfProfile = CodeHelpers.emptyToNull(base.getVnfProfile()); + } + + public DfImpl() { + this( new DfBuilder()); + } + +// public Map setVnfProfile(final List values) { +// return _vnfProfile = CodeHelpers.compatMap(values) ; +// } + + @JsonSetter("vnf-profile") + public Map setVnfProfile(final List values) { + if(values==null) + return null; + if(values.isEmpty()) + return null; + else + { + Map result = new HashMap<>(); + for(VnfProfile value:values) { + result.put(new VnfProfileKey(value.getId()),value); + } + this._vnfProfile=result; + return result; + } + } + + @Override + public DfKey key() { + return key; + } + + @Override + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + @Override + public String getDefaultInstantiationLevel() { + return _defaultInstantiationLevel; + } + + @Override + public Map getDependencies() { + return _dependencies; + } + + @Override + public String getFlavourKey() { + return _flavourKey; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getMonitoredInfo() { + return _monitoredInfo; + } + + @Override + public Map getNsInstantiationLevel() { + return _nsInstantiationLevel; + } + + @Override + public Map getNsProfile() { + return _nsProfile; + } + + @Override + public Map getPnfProfile() { + return _pnfProfile; + } + + @Override + public Map getScalingAspect() { + return _scalingAspect; + } + + @Override + public Map getVirtualLinkProfile() { + return _virtualLinkProfile; + } + + @Override + public Map getVnfProfile() { + return _vnfProfile; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_affinityOrAntiAffinityGroup); + result = prime * result + Objects.hashCode(_defaultInstantiationLevel); + result = prime * result + Objects.hashCode(_dependencies); + result = prime * result + Objects.hashCode(_flavourKey); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_monitoredInfo); + result = prime * result + Objects.hashCode(_nsInstantiationLevel); + result = prime * result + Objects.hashCode(_nsProfile); + result = prime * result + Objects.hashCode(_pnfProfile); + result = prime * result + Objects.hashCode(_scalingAspect); + result = prime * result + Objects.hashCode(_virtualLinkProfile); + result = prime * result + Objects.hashCode(_vnfProfile); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Df.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Df other = (Df)obj; + if (!Objects.equals(_affinityOrAntiAffinityGroup, other.getAffinityOrAntiAffinityGroup())) { + return false; + } + if (!Objects.equals(_defaultInstantiationLevel, other.getDefaultInstantiationLevel())) { + return false; + } + if (!Objects.equals(_dependencies, other.getDependencies())) { + return false; + } + if (!Objects.equals(_flavourKey, other.getFlavourKey())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_monitoredInfo, other.getMonitoredInfo())) { + return false; + } + if (!Objects.equals(_nsInstantiationLevel, other.getNsInstantiationLevel())) { + return false; + } + if (!Objects.equals(_nsProfile, other.getNsProfile())) { + return false; + } + if (!Objects.equals(_pnfProfile, other.getPnfProfile())) { + return false; + } + if (!Objects.equals(_scalingAspect, other.getScalingAspect())) { + return false; + } + if (!Objects.equals(_virtualLinkProfile, other.getVirtualLinkProfile())) { + return false; + } + if (!Objects.equals(_vnfProfile, other.getVnfProfile())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + DfImpl otherImpl = (DfImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Df"); + CodeHelpers.appendValue(helper, "_affinityOrAntiAffinityGroup", _affinityOrAntiAffinityGroup); + CodeHelpers.appendValue(helper, "_defaultInstantiationLevel", _defaultInstantiationLevel); + CodeHelpers.appendValue(helper, "_dependencies", _dependencies); + CodeHelpers.appendValue(helper, "_flavourKey", _flavourKey); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_monitoredInfo", _monitoredInfo); + CodeHelpers.appendValue(helper, "_nsInstantiationLevel", _nsInstantiationLevel); + CodeHelpers.appendValue(helper, "_nsProfile", _nsProfile); + CodeHelpers.appendValue(helper, "_pnfProfile", _pnfProfile); + CodeHelpers.appendValue(helper, "_scalingAspect", _scalingAspect); + CodeHelpers.appendValue(helper, "_virtualLinkProfile", _virtualLinkProfile); + CodeHelpers.appendValue(helper, "_vnfProfile", _vnfProfile); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/DfKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/DfKey.java new file mode 100644 index 0000000000000000000000000000000000000000..598abf2f798e2fe0d8a63cef07ede0acb0d56904 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/DfKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class DfKey + implements Identifier { + private static final long serialVersionUID = 4083286612161956839L; + private final String _id; + + + public DfKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public DfKey(DfKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DfKey)) { + return false; + } + final DfKey other = (DfKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(DfKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/LifecycleManagementScript.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/LifecycleManagementScript.java new file mode 100644 index 0000000000000000000000000000000000000000..02d7935f3d3ebada069318c6fb47e740c8728903 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/LifecycleManagementScript.java @@ -0,0 +1,66 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list lifecycle-management-script {
+ *   key event;
+ *   leaf event {
+ *     type string;
+ *   }
+ *   leaf script {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/lifecycle-management-script + * + *

To create instances of this class use {@link LifecycleManagementScriptBuilder}. + * @see LifecycleManagementScriptBuilder + * @see LifecycleManagementScriptKey + * + */ +public interface LifecycleManagementScript + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("lifecycle-management-script"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.LifecycleManagementScript.class; + } + + /** + * @return java.lang.String event, or null if not present + */ + @Nullable String getEvent(); + + /** + * @return java.lang.String script, or null if not present + */ + @Nullable String getScript(); + + @Override + LifecycleManagementScriptKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/LifecycleManagementScriptBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/LifecycleManagementScriptBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..d34e6b984b81f37d5a6033ce257206c349f9b52a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/LifecycleManagementScriptBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link LifecycleManagementScriptBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     LifecycleManagementScriptBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new LifecycleManagementScriptBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of LifecycleManagementScriptBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see LifecycleManagementScriptBuilder + * @see Builder + * + */ +public class LifecycleManagementScriptBuilder implements Builder { + + private String _event; + private String _script; + private LifecycleManagementScriptKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public LifecycleManagementScriptBuilder() { + } + + public LifecycleManagementScriptBuilder(LifecycleManagementScript base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._event = base.getEvent(); + this._script = base.getScript(); + } + + + public LifecycleManagementScriptKey key() { + return key; + } + + public String getEvent() { + return _event; + } + + public String getScript() { + return _script; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public LifecycleManagementScriptBuilder withKey(final LifecycleManagementScriptKey key) { + this.key = key; + return this; + } + + public LifecycleManagementScriptBuilder setEvent(final String value) { + this._event = value; + return this; + } + + public LifecycleManagementScriptBuilder setScript(final String value) { + this._script = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public LifecycleManagementScriptBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public LifecycleManagementScriptBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public LifecycleManagementScriptBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private LifecycleManagementScriptBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public LifecycleManagementScript build() { + return new LifecycleManagementScriptImpl(this); + } + + private static final class LifecycleManagementScriptImpl + extends AbstractAugmentable + implements LifecycleManagementScript { + + private final String _event; + private final String _script; + private final LifecycleManagementScriptKey key; + + LifecycleManagementScriptImpl(LifecycleManagementScriptBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new LifecycleManagementScriptKey(base.getEvent()); + } + this._event = key.getEvent(); + this._script = base.getScript(); + } + + @Override + public LifecycleManagementScriptKey key() { + return key; + } + + @Override + public String getEvent() { + return _event; + } + + @Override + public String getScript() { + return _script; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_event); + result = prime * result + Objects.hashCode(_script); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!LifecycleManagementScript.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + LifecycleManagementScript other = (LifecycleManagementScript)obj; + if (!Objects.equals(_event, other.getEvent())) { + return false; + } + if (!Objects.equals(_script, other.getScript())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + LifecycleManagementScriptImpl otherImpl = (LifecycleManagementScriptImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("LifecycleManagementScript"); + CodeHelpers.appendValue(helper, "_event", _event); + CodeHelpers.appendValue(helper, "_script", _script); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/LifecycleManagementScriptKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/LifecycleManagementScriptKey.java new file mode 100644 index 0000000000000000000000000000000000000000..db00eee939f4bd70d77a8065add29da7a7e69e2f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/LifecycleManagementScriptKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class LifecycleManagementScriptKey + implements Identifier { + private static final long serialVersionUID = -7557130487871185497L; + private final String _event; + + + public LifecycleManagementScriptKey(String _event) { + + this._event = _event; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public LifecycleManagementScriptKey(LifecycleManagementScriptKey source) { + this._event = source._event; + } + + + public String getEvent() { + return _event; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_event); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof LifecycleManagementScriptKey)) { + return false; + } + final LifecycleManagementScriptKey other = (LifecycleManagementScriptKey) obj; + if (!Objects.equals(_event, other._event)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(LifecycleManagementScriptKey.class); + CodeHelpers.appendValue(helper, "_event", _event); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/Sapd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/Sapd.java new file mode 100644 index 0000000000000000000000000000000000000000..3a1bd290b52830b3ed35a1705cd915fad2352adf --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/Sapd.java @@ -0,0 +1,139 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.CpdOrVirtualLink; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Provides the descriptor of a service access point of the network service. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list sapd {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf address-assignment {
+ *     type boolean;
+ *   }
+ *   choice cpd-or-virtual-link {
+ *     case virtual-link-desc {
+ *       leaf virtual-link-desc {
+ *         type leafref {
+ *           path ../../virtual-link-desc/id;
+ *         }
+ *       }
+ *     }
+ *     case vnf {
+ *       container vnf {
+ *         leaf vnfd-id {
+ *           type leafref {
+ *             path ../../../../vnfd/id;
+ *           }
+ *           must boolean(../../../vnfd-id[.=current()]);
+ *         }
+ *         leaf ext-cpd-id {
+ *           type leafref {
+ *             path deref(../vnfd-id)/../ext-cpd/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     case pnf {
+ *       container pnf {
+ *         leaf pnfd-id {
+ *           type leafref {
+ *             path ../../../../pnfd/id;
+ *           }
+ *           must boolean(../pnfd-id[.=current()]);
+ *         }
+ *         leaf ext-cpd-id {
+ *           type leafref {
+ *             path deref(../pnfd-id)/../ext-cpd/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     case ns {
+ *       container ns {
+ *         leaf nsd-id {
+ *           type leafref {
+ *             path ../../../../nsd/id;
+ *           }
+ *           must boolean(../nsd-id[.=current()]);
+ *         }
+ *         leaf ext-cpd-id {
+ *           type leafref {
+ *             path deref(../nsd-id)/../sapd/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/sapd + * + *

To create instances of this class use {@link SapdBuilder}. + * @see SapdBuilder + * @see SapdKey + * + */ +public interface Sapd + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("sapd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Sapd.class; + } + + /** + * Identifier of this Cpd information element. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Specify whether the SAP address assignment is under the responsibility of + * management and orchestration functions or not. If it is set to True, management + * and orchestration functions are responsible for assigning addresses to the + * access points instantiated from this SAPD. + * + * + * + * @return java.lang.Boolean addressAssignment, or null if not present + */ + @Nullable Boolean isAddressAssignment(); + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.CpdOrVirtualLink cpdOrVirtualLink, or null if not present + */ + @Nullable CpdOrVirtualLink getCpdOrVirtualLink(); + + @Override + SapdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/SapdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/SapdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..7b130747ea747e740b1421d5d6c33fa975f1c96d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/SapdBuilder.java @@ -0,0 +1,296 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.CpdOrVirtualLink; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link SapdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     SapdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new SapdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of SapdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see SapdBuilder + * @see Builder + * + */ +public class SapdBuilder implements Builder { + + private CpdOrVirtualLink _cpdOrVirtualLink; + private String _id; + private Boolean _addressAssignment; + private SapdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public SapdBuilder() { + } + + public SapdBuilder(Sapd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._cpdOrVirtualLink = base.getCpdOrVirtualLink(); + this._addressAssignment = base.isAddressAssignment(); + } + + + public SapdKey key() { + return key; + } + + public CpdOrVirtualLink getCpdOrVirtualLink() { + return _cpdOrVirtualLink; + } + + public String getId() { + return _id; + } + + public Boolean isAddressAssignment() { + return _addressAssignment; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public SapdBuilder withKey(final SapdKey key) { + this.key = key; + return this; + } + + public SapdBuilder setCpdOrVirtualLink(final CpdOrVirtualLink value) { + this._cpdOrVirtualLink = value; + return this; + } + + public SapdBuilder setId(final String value) { + this._id = value; + return this; + } + + public SapdBuilder setAddressAssignment(final Boolean value) { + this._addressAssignment = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public SapdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public SapdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public SapdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private SapdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Sapd build() { + return new SapdImpl(this); + } + + private static final class SapdImpl + extends AbstractAugmentable + implements Sapd { + + private final CpdOrVirtualLink _cpdOrVirtualLink; + private final String _id; + private final Boolean _addressAssignment; + private final SapdKey key; + + SapdImpl(SapdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new SapdKey(base.getId()); + } + this._id = key.getId(); + this._cpdOrVirtualLink = base.getCpdOrVirtualLink(); + this._addressAssignment = base.isAddressAssignment(); + } + + @Override + public SapdKey key() { + return key; + } + + @Override + public CpdOrVirtualLink getCpdOrVirtualLink() { + return _cpdOrVirtualLink; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Boolean isAddressAssignment() { + return _addressAssignment; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cpdOrVirtualLink); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_addressAssignment); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Sapd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Sapd other = (Sapd)obj; + if (!Objects.equals(_cpdOrVirtualLink, other.getCpdOrVirtualLink())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_addressAssignment, other.isAddressAssignment())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + SapdImpl otherImpl = (SapdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Sapd"); + CodeHelpers.appendValue(helper, "_cpdOrVirtualLink", _cpdOrVirtualLink); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_addressAssignment", _addressAssignment); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/SapdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/SapdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..2fcbbca21368c24a0af4978b07531b5842bd8fc8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/SapdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class SapdKey + implements Identifier { + private static final long serialVersionUID = 7153644156739384387L; + private final String _id; + + + public SapdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public SapdKey(SapdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof SapdKey)) { + return false; + } + final SapdKey other = (SapdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(SapdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VirtualLinkDesc.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VirtualLinkDesc.java new file mode 100644 index 0000000000000000000000000000000000000000..710edcd49ef64816e7c3b18666b97857de9afe50 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VirtualLinkDesc.java @@ -0,0 +1,221 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.DfKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Provides the constituent VLDs. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list virtual-link-desc {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   uses connectivity-type;
+ *   list df {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     container qos {
+ *       presence "VL QoS parameters";
+ *       leaf latency {
+ *         type uint32;
+ *         units ms;
+ *       }
+ *       leaf packet-delay-variation {
+ *         type uint32;
+ *         units ms;
+ *       }
+ *       leaf packet-loss-ratio {
+ *         type decimal64 {
+ *           fraction-digits 2;
+ *           range 0..1.00;
+ *         }
+ *       }
+ *       leaf priority {
+ *         type uint32;
+ *       }
+ *     }
+ *     leaf service-availability-level {
+ *       type enumeration {
+ *         enum level-1;
+ *         enum level-2;
+ *         enum level-3;
+ *       }
+ *     }
+ *   }
+ *   leaf test-access {
+ *     type enumeration {
+ *       enum none;
+ *       enum passive-monitoring;
+ *       enum active;
+ *     }
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   uses security-parameters;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/virtual-link-desc + * + *

To create instances of this class use {@link VirtualLinkDescBuilder}. + * @see VirtualLinkDescBuilder + * @see VirtualLinkDescKey + * + */ +public interface VirtualLinkDesc + extends + ChildOf, + Augmentable, + ConnectivityType, + SecurityParameters, + Identifiable +{ + + + public enum TestAccess implements Enumeration { + None(0, "none"), + + PassiveMonitoring(1, "passive-monitoring"), + + Active(2, "active") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (TestAccess enumItem : TestAccess.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private TestAccess(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding TestAccess item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding TestAccess item, or null if no such item exists + */ + public static TestAccess forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-link-desc"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VirtualLinkDesc.class; + } + + /** + * Identifier of the NsVirtualLinkDesc information element. It uniquely identifies + * a VLD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * The VirtualLinkDf information element specifies properties for instantiating a + * VL according to a specific flavour. + * + * + * + * @return java.util.Map df, or null if not present + */ + @Nullable Map getDf(); + + /** + * @return java.util.Map df, or an empty list if it is not present + */ + default @NonNull Map nonnullDf() { + return CodeHelpers.nonnull(getDf()); + } + + /** + * Specifies test access facilities expected on the VL. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VirtualLinkDesc.TestAccess testAccess, or null if not present + */ + @Nullable TestAccess getTestAccess(); + + /** + * Provides human-readable information on the purpose of the virtual link (e.g. VL + * for control plane traffic). + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + @Override + VirtualLinkDescKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VirtualLinkDescBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VirtualLinkDescBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..fe1e74699c588c762dd6aa6be6d1bd6b1dc26b75 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VirtualLinkDescBuilder.java @@ -0,0 +1,464 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.connectivity.type.ConnectivityType; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.DfKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualLinkDescBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkDescBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkDescBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkDescBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkDescBuilder + * @see Builder + * + */ +public class VirtualLinkDescBuilder implements Builder { + + private String _algorithm; + private String _certificate; + private ConnectivityType _connectivityType; + private String _description; + private Map _df; + private String _id; + private String _signature; + private VirtualLinkDesc.TestAccess _testAccess; + private VirtualLinkDescKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualLinkDescBuilder() { + } + public VirtualLinkDescBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType arg) { + this._connectivityType = arg.getConnectivityType(); + } + public VirtualLinkDescBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters arg) { + this._signature = arg.getSignature(); + this._algorithm = arg.getAlgorithm(); + this._certificate = arg.getCertificate(); + } + + public VirtualLinkDescBuilder(VirtualLinkDesc base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._algorithm = base.getAlgorithm(); + this._certificate = base.getCertificate(); + this._connectivityType = base.getConnectivityType(); + this._description = base.getDescription(); + this._df = base.getDf(); + this._signature = base.getSignature(); + this._testAccess = base.getTestAccess(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType) { + this._connectivityType = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType)arg).getConnectivityType(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters) { + this._signature = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getSignature(); + this._algorithm = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getAlgorithm(); + this._certificate = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getCertificate(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType, org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters]"); + } + + public VirtualLinkDescKey key() { + return key; + } + + public String getAlgorithm() { + return _algorithm; + } + + public String getCertificate() { + return _certificate; + } + + public ConnectivityType getConnectivityType() { + return _connectivityType; + } + + public String getDescription() { + return _description; + } + + public Map getDf() { + return _df; + } + + public String getId() { + return _id; + } + + public String getSignature() { + return _signature; + } + + public VirtualLinkDesc.TestAccess getTestAccess() { + return _testAccess; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VirtualLinkDescBuilder withKey(final VirtualLinkDescKey key) { + this.key = key; + return this; + } + + public VirtualLinkDescBuilder setAlgorithm(final String value) { + this._algorithm = value; + return this; + } + + public VirtualLinkDescBuilder setCertificate(final String value) { + this._certificate = value; + return this; + } + + public VirtualLinkDescBuilder setConnectivityType(final ConnectivityType value) { + this._connectivityType = value; + return this; + } + + public VirtualLinkDescBuilder setDescription(final String value) { + this._description = value; + return this; + } + public VirtualLinkDescBuilder setDf(final Map values) { + this._df = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setDf(Map)} instead. + */ + @Deprecated(forRemoval = true) + @JsonIgnore + public VirtualLinkDescBuilder setDf(final List values) { + return setDf(CodeHelpers.compatMap(values)); + } + + public VirtualLinkDescBuilder setId(final String value) { + this._id = value; + return this; + } + + public VirtualLinkDescBuilder setSignature(final String value) { + this._signature = value; + return this; + } + + public VirtualLinkDescBuilder setTestAccess(final VirtualLinkDesc.TestAccess value) { + this._testAccess = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualLinkDescBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkDescBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualLinkDescBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualLinkDescBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualLinkDesc build() { + return new VirtualLinkDescImpl(this); + } + + private static final class VirtualLinkDescImpl + extends AbstractAugmentable + implements VirtualLinkDesc { + + private final String _algorithm; + private final String _certificate; + private final ConnectivityType _connectivityType; + private final String _description; + private final Map _df; + private final String _id; + private final String _signature; + private final VirtualLinkDesc.TestAccess _testAccess; + private final VirtualLinkDescKey key; + + VirtualLinkDescImpl(VirtualLinkDescBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VirtualLinkDescKey(base.getId()); + } + this._id = key.getId(); + this._algorithm = base.getAlgorithm(); + this._certificate = base.getCertificate(); + this._connectivityType = base.getConnectivityType(); + this._description = base.getDescription(); + this._df = CodeHelpers.emptyToNull(base.getDf()); + this._signature = base.getSignature(); + this._testAccess = base.getTestAccess(); + } + + @Override + public VirtualLinkDescKey key() { + return key; + } + + @Override + public String getAlgorithm() { + return _algorithm; + } + + @Override + public String getCertificate() { + return _certificate; + } + + @Override + public ConnectivityType getConnectivityType() { + return _connectivityType; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public Map getDf() { + return _df; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getSignature() { + return _signature; + } + + @Override + public VirtualLinkDesc.TestAccess getTestAccess() { + return _testAccess; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_algorithm); + result = prime * result + Objects.hashCode(_certificate); + result = prime * result + Objects.hashCode(_connectivityType); + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_df); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_signature); + result = prime * result + Objects.hashCode(_testAccess); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkDesc.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkDesc other = (VirtualLinkDesc)obj; + if (!Objects.equals(_algorithm, other.getAlgorithm())) { + return false; + } + if (!Objects.equals(_certificate, other.getCertificate())) { + return false; + } + if (!Objects.equals(_connectivityType, other.getConnectivityType())) { + return false; + } + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_df, other.getDf())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_signature, other.getSignature())) { + return false; + } + if (!Objects.equals(_testAccess, other.getTestAccess())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualLinkDescImpl otherImpl = (VirtualLinkDescImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkDesc"); + CodeHelpers.appendValue(helper, "_algorithm", _algorithm); + CodeHelpers.appendValue(helper, "_certificate", _certificate); + CodeHelpers.appendValue(helper, "_connectivityType", _connectivityType); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_df", _df); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_signature", _signature); + CodeHelpers.appendValue(helper, "_testAccess", _testAccess); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VirtualLinkDescKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VirtualLinkDescKey.java new file mode 100644 index 0000000000000000000000000000000000000000..c6d324d4e42406c454098431e284fc087ca5641c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VirtualLinkDescKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VirtualLinkDescKey + implements Identifier { + private static final long serialVersionUID = 6490584508262845370L; + private final String _id; + + + public VirtualLinkDescKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VirtualLinkDescKey(VirtualLinkDescKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VirtualLinkDescKey)) { + return false; + } + final VirtualLinkDescKey other = (VirtualLinkDescKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VirtualLinkDescKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/Vnffgd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/Vnffgd.java new file mode 100644 index 0000000000000000000000000000000000000000..0995e82a0f58c1cc7b84773a6cb25170faf52fed --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/Vnffgd.java @@ -0,0 +1,269 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPool; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPoolKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.Nfpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.NfpdKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Provides the descriptors of the applicable forwarding graphs. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list vnffgd {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf-list vnf-profile-id {
+ *     type leafref {
+ *       path ../../df/vnf-profile/id;
+ *     }
+ *   }
+ *   leaf-list pnf-profile-id {
+ *     type leafref {
+ *       path ../../df/pnf-profile/id;
+ *     }
+ *   }
+ *   leaf-list nested-ns-profile-id {
+ *     type leafref {
+ *       path ../../df/ns-profile/id;
+ *     }
+ *   }
+ *   leaf virtual-link-profile-id {
+ *     type leafref {
+ *       path ../../df/virtual-link-profile/id;
+ *     }
+ *   }
+ *   list cpd-pool {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     choice constituent-base-element-id {
+ *       case vnf-profile {
+ *         container vnf-profile {
+ *           leaf vnf-profile-id {
+ *             type leafref {
+ *               path ../../../../../nsd/df/vnf-profile/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *       case pnf-profile {
+ *         container pnf-profile {
+ *           leaf pnf-profile-id {
+ *             type leafref {
+ *               path ../../../../../nsd/df/pnf-profile/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *       case ns-profile {
+ *         container ns-profile {
+ *           leaf ns-profile-id {
+ *             type leafref {
+ *               path ../../../../../nsd/df/ns-profile/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *     }
+ *     choice constituent-cpd-id {
+ *       case vnf {
+ *         container vnf {
+ *           leaf vnfd-id {
+ *             type leafref {
+ *               path ../../../../../vnfd/id;
+ *             }
+ *           }
+ *           leaf cpd-id {
+ *             type leafref {
+ *               path deref(../vnfd-id)/../ext-cpd/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *       case pnf {
+ *         container pnf {
+ *           leaf pnfd-id {
+ *             type leafref {
+ *               path ../../../../../pnfd/id;
+ *             }
+ *           }
+ *           leaf pnf-cpd-id {
+ *             type leafref {
+ *               path deref(../pnfd-id)/../ext-cpd/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *       case ns {
+ *         container ns {
+ *           leaf nsd-id {
+ *             type leafref {
+ *               path ../../../../../nsd/id;
+ *             }
+ *           }
+ *           leaf sap-cpd-id {
+ *             type leafref {
+ *               path deref(../nsd-id)/../sapd/id;
+ *             }
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ *   list nfpd {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf rule {
+ *       type string;
+ *     }
+ *     list position-desc-id {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       list cp-profile-id {
+ *         key id;
+ *         leaf id {
+ *           type string;
+ *         }
+ *         list constituent-profile-elements {
+ *           key id;
+ *           leaf id {
+ *             type string;
+ *           }
+ *           leaf cpd-id {
+ *             type string;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd + * + *

To create instances of this class use {@link VnffgdBuilder}. + * @see VnffgdBuilder + * @see VnffgdKey + * + */ +public interface Vnffgd + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnffgd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Vnffgd.class; + } + + /** + * Identifier of this Vnffgd information element. It uniquely identifies a VNFFGD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * References the VnfProfile of a constituent VNF. + * + * + * + * @return java.util.List vnfProfileId, or null if not present + */ + @Nullable List getVnfProfileId(); + + /** + * References the PnfProfile of a constituent PNF. + * + * + * + * @return java.util.List pnfProfileId, or null if not present + */ + @Nullable List getPnfProfileId(); + + /** + * References the NsProfile of a nestedNS. + * + * + * + * @return java.util.List nestedNsProfileId, or null if not present + */ + @Nullable List getNestedNsProfileId(); + + /** + * References the Virtual Link Profile of a constituent VL. + * + * + * + * @return java.lang.String virtualLinkProfileId, or null if not present + */ + @Nullable String getVirtualLinkProfileId(); + + /** + * Describes a pool of descriptors of connection points attached to one of the + * constituent VNFs and PNFs and/or one of the SAPs of the parent NS or of a nested + * NS. + * + * + * + * @return java.util.Map cpdPool, or null if not present + */ + @Nullable Map getCpdPool(); + + /** + * @return java.util.Map cpdPool, or an empty list if it is not present + */ + default @NonNull Map nonnullCpdPool() { + return CodeHelpers.nonnull(getCpdPool()); + } + + /** + * The network forwarding path associated to the VNFFG. + * + * + * + * @return java.util.Map nfpd, or null if not present + */ + @Nullable Map getNfpd(); + + /** + * @return java.util.Map nfpd, or an empty list if it is not present + */ + default @NonNull Map nonnullNfpd() { + return CodeHelpers.nonnull(getNfpd()); + } + + @Override + VnffgdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VnffgdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VnffgdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..86c40243249a8ccb3e8a8098df62a7328a6d6757 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VnffgdBuilder.java @@ -0,0 +1,425 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPool; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPoolKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.Nfpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.NfpdKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VnffgdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnffgdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnffgdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnffgdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnffgdBuilder + * @see Builder + * + */ +public class VnffgdBuilder implements Builder { + + private Map _cpdPool; + private String _id; + private List _nestedNsProfileId; + private Map _nfpd; + private List _pnfProfileId; + private String _virtualLinkProfileId; + private List _vnfProfileId; + private VnffgdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnffgdBuilder() { + } + + public VnffgdBuilder(Vnffgd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._cpdPool = base.getCpdPool(); + this._nestedNsProfileId = base.getNestedNsProfileId(); + this._nfpd = base.getNfpd(); + this._pnfProfileId = base.getPnfProfileId(); + this._virtualLinkProfileId = base.getVirtualLinkProfileId(); + this._vnfProfileId = base.getVnfProfileId(); + } + + + public VnffgdKey key() { + return key; + } + + public Map getCpdPool() { + return _cpdPool; + } + + public String getId() { + return _id; + } + + public List getNestedNsProfileId() { + return _nestedNsProfileId; + } + + public Map getNfpd() { + return _nfpd; + } + + public List getPnfProfileId() { + return _pnfProfileId; + } + + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + public List getVnfProfileId() { + return _vnfProfileId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VnffgdBuilder withKey(final VnffgdKey key) { + this.key = key; + return this; + } + public VnffgdBuilder setCpdPool(final Map values) { + this._cpdPool = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setCpdPool(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnffgdBuilder setCpdPool(final List values) { + return setCpdPool(CodeHelpers.compatMap(values)); + } + + public VnffgdBuilder setId(final String value) { + this._id = value; + return this; + } + public VnffgdBuilder setNestedNsProfileId(final List values) { + this._nestedNsProfileId = values; + return this; + } + + public VnffgdBuilder setNfpd(final Map values) { + this._nfpd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setNfpd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnffgdBuilder setNfpd(final List values) { + return setNfpd(CodeHelpers.compatMap(values)); + } + public VnffgdBuilder setPnfProfileId(final List values) { + this._pnfProfileId = values; + return this; + } + + + public VnffgdBuilder setVirtualLinkProfileId(final String value) { + this._virtualLinkProfileId = value; + return this; + } + public VnffgdBuilder setVnfProfileId(final List values) { + this._vnfProfileId = values; + return this; + } + + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnffgdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnffgdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnffgdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnffgdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Vnffgd build() { + return new VnffgdImpl(this); + } + + private static final class VnffgdImpl + extends AbstractAugmentable + implements Vnffgd { + + private final Map _cpdPool; + private final String _id; + private final List _nestedNsProfileId; + private final Map _nfpd; + private final List _pnfProfileId; + private final String _virtualLinkProfileId; + private final List _vnfProfileId; + private final VnffgdKey key; + + VnffgdImpl(VnffgdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VnffgdKey(base.getId()); + } + this._id = key.getId(); + this._cpdPool = CodeHelpers.emptyToNull(base.getCpdPool()); + this._nestedNsProfileId = base.getNestedNsProfileId(); + this._nfpd = CodeHelpers.emptyToNull(base.getNfpd()); + this._pnfProfileId = base.getPnfProfileId(); + this._virtualLinkProfileId = base.getVirtualLinkProfileId(); + this._vnfProfileId = base.getVnfProfileId(); + } + + @Override + public VnffgdKey key() { + return key; + } + + @Override + public Map getCpdPool() { + return _cpdPool; + } + + @Override + public String getId() { + return _id; + } + + @Override + public List getNestedNsProfileId() { + return _nestedNsProfileId; + } + + @Override + public Map getNfpd() { + return _nfpd; + } + + @Override + public List getPnfProfileId() { + return _pnfProfileId; + } + + @Override + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + @Override + public List getVnfProfileId() { + return _vnfProfileId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cpdPool); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_nestedNsProfileId); + result = prime * result + Objects.hashCode(_nfpd); + result = prime * result + Objects.hashCode(_pnfProfileId); + result = prime * result + Objects.hashCode(_virtualLinkProfileId); + result = prime * result + Objects.hashCode(_vnfProfileId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vnffgd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vnffgd other = (Vnffgd)obj; + if (!Objects.equals(_cpdPool, other.getCpdPool())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_nestedNsProfileId, other.getNestedNsProfileId())) { + return false; + } + if (!Objects.equals(_nfpd, other.getNfpd())) { + return false; + } + if (!Objects.equals(_pnfProfileId, other.getPnfProfileId())) { + return false; + } + if (!Objects.equals(_virtualLinkProfileId, other.getVirtualLinkProfileId())) { + return false; + } + if (!Objects.equals(_vnfProfileId, other.getVnfProfileId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnffgdImpl otherImpl = (VnffgdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vnffgd"); + CodeHelpers.appendValue(helper, "_cpdPool", _cpdPool); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_nestedNsProfileId", _nestedNsProfileId); + CodeHelpers.appendValue(helper, "_nfpd", _nfpd); + CodeHelpers.appendValue(helper, "_pnfProfileId", _pnfProfileId); + CodeHelpers.appendValue(helper, "_virtualLinkProfileId", _virtualLinkProfileId); + CodeHelpers.appendValue(helper, "_vnfProfileId", _vnfProfileId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VnffgdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VnffgdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..c41f4d3034dd2006c412794f5437d071aecc71c7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/VnffgdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VnffgdKey + implements Identifier { + private static final long serialVersionUID = -1143939609367754999L; + private final String _id; + + + public VnffgdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VnffgdKey(VnffgdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VnffgdKey)) { + return false; + } + final VnffgdKey other = (VnffgdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VnffgdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/AffinityOrAntiAffinityGroup.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/AffinityOrAntiAffinityGroup.java new file mode 100644 index 0000000000000000000000000000000000000000..35b8b33e047ebb1ee3b162c0daa66f69f5f8cf24 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/AffinityOrAntiAffinityGroup.java @@ -0,0 +1,95 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityScope; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityType; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies affinity or anti-affinity relationship applicable between the VNF + * instances created using different VNFDs, the Virtual Link instances created + * using different NsVirtualLinkDescs or the nested NS instances created using + * different NSDs in the same affinity or anti-affinity group. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list affinity-or-anti-affinity-group {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf type {
+ *     type affinity-type;
+ *   }
+ *   leaf scope {
+ *     type affinity-scope;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/affinity-or-anti-affinity-group + * + *

To create instances of this class use {@link AffinityOrAntiAffinityGroupBuilder}. + * @see AffinityOrAntiAffinityGroupBuilder + * @see AffinityOrAntiAffinityGroupKey + * + */ +public interface AffinityOrAntiAffinityGroup + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("affinity-or-anti-affinity-group"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.AffinityOrAntiAffinityGroup.class; + } + + /** + * Identifier of Identifier of this AffinityOrAntiAffinityGroup information + * element. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Specifies the type of relationship that the members of the group have: + * 'affinity' or 'anti-affinity.' + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityType type, or null if not present + */ + @Nullable AffinityType getType(); + + /** + * Specifies the scope of the affinity or anti-affinity relationship e.g. a NFVI + * node, an NFVI PoP, etc. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityScope scope, or null if not present + */ + @Nullable AffinityScope getScope(); + + @Override + AffinityOrAntiAffinityGroupKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/AffinityOrAntiAffinityGroupBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/AffinityOrAntiAffinityGroupBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..3df383ca0b8e46bd5e06c946075284ad577afe14 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/AffinityOrAntiAffinityGroupBuilder.java @@ -0,0 +1,296 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityScope; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityType; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link AffinityOrAntiAffinityGroupBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AffinityOrAntiAffinityGroupBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AffinityOrAntiAffinityGroupBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AffinityOrAntiAffinityGroupBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AffinityOrAntiAffinityGroupBuilder + * @see Builder + * + */ +public class AffinityOrAntiAffinityGroupBuilder implements Builder { + + private String _id; + private AffinityScope _scope; + private AffinityType _type; + private AffinityOrAntiAffinityGroupKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AffinityOrAntiAffinityGroupBuilder() { + } + + public AffinityOrAntiAffinityGroupBuilder(AffinityOrAntiAffinityGroup base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._scope = base.getScope(); + this._type = base.getType(); + } + + + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + public String getId() { + return _id; + } + + public AffinityScope getScope() { + return _scope; + } + + public AffinityType getType() { + return _type; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AffinityOrAntiAffinityGroupBuilder withKey(final AffinityOrAntiAffinityGroupKey key) { + this.key = key; + return this; + } + + public AffinityOrAntiAffinityGroupBuilder setId(final String value) { + this._id = value; + return this; + } + + public AffinityOrAntiAffinityGroupBuilder setScope(final AffinityScope value) { + this._scope = value; + return this; + } + + public AffinityOrAntiAffinityGroupBuilder setType(final AffinityType value) { + this._type = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AffinityOrAntiAffinityGroupBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AffinityOrAntiAffinityGroupBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public AffinityOrAntiAffinityGroup build() { + return new AffinityOrAntiAffinityGroupImpl(this); + } + + private static final class AffinityOrAntiAffinityGroupImpl + extends AbstractAugmentable + implements AffinityOrAntiAffinityGroup { + + private final String _id; + private final AffinityScope _scope; + private final AffinityType _type; + private final AffinityOrAntiAffinityGroupKey key; + + AffinityOrAntiAffinityGroupImpl(AffinityOrAntiAffinityGroupBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new AffinityOrAntiAffinityGroupKey(base.getId()); + } + this._id = key.getId(); + this._scope = base.getScope(); + this._type = base.getType(); + } + + @Override + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public AffinityScope getScope() { + return _scope; + } + + @Override + public AffinityType getType() { + return _type; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_scope); + result = prime * result + Objects.hashCode(_type); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!AffinityOrAntiAffinityGroup.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + AffinityOrAntiAffinityGroup other = (AffinityOrAntiAffinityGroup)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_scope, other.getScope())) { + return false; + } + if (!Objects.equals(_type, other.getType())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AffinityOrAntiAffinityGroupImpl otherImpl = (AffinityOrAntiAffinityGroupImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("AffinityOrAntiAffinityGroup"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_scope", _scope); + CodeHelpers.appendValue(helper, "_type", _type); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/AffinityOrAntiAffinityGroupKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/AffinityOrAntiAffinityGroupKey.java new file mode 100644 index 0000000000000000000000000000000000000000..392a584d3fe5308a1ec217a2a3d5c37304a53d4c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/AffinityOrAntiAffinityGroupKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class AffinityOrAntiAffinityGroupKey + implements Identifier { + private static final long serialVersionUID = -4909084403753675647L; + private final String _id; + + + public AffinityOrAntiAffinityGroupKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public AffinityOrAntiAffinityGroupKey(AffinityOrAntiAffinityGroupKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof AffinityOrAntiAffinityGroupKey)) { + return false; + } + final AffinityOrAntiAffinityGroupKey other = (AffinityOrAntiAffinityGroupKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(AffinityOrAntiAffinityGroupKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/Dependencies.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/Dependencies.java new file mode 100644 index 0000000000000000000000000000000000000000..3cb48702eae50974b6c20fd05ec867619f093e2f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/Dependencies.java @@ -0,0 +1,112 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.PrimaryId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.SecondaryId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies the order in which instances of the VNFs and/or nested NSs have to be + * created. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list dependencies {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   choice primary-id {
+ *     case primary-vnf-profile {
+ *       leaf primary-vnf-profile {
+ *         type leafref {
+ *           path ../../vnf-profile/vnfd-id;
+ *         }
+ *       }
+ *     }
+ *     case primary-ns-profile {
+ *       leaf primary-ns-profile {
+ *         type leafref {
+ *           path ../../ns-profile/nsd-id;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   choice secondary-id {
+ *     case secondary-vnf-profile {
+ *       leaf secondary-vnf-profile {
+ *         type leafref {
+ *           path ../../vnf-profile/vnfd-id;
+ *         }
+ *       }
+ *     }
+ *     case secondary-ns-profile {
+ *       leaf secondary-ns-profile {
+ *         type leafref {
+ *           path ../../ns-profile/nsd-id;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/dependencies + * + *

To create instances of this class use {@link DependenciesBuilder}. + * @see DependenciesBuilder + * @see DependenciesKey + * + */ +public interface Dependencies + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("dependencies"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.Dependencies.class; + } + + /** + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * References a VnfProfile or NsProfile. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.PrimaryId primaryId, or null if not present + */ + @Nullable PrimaryId getPrimaryId(); + + /** + * References a VnfProfile or NsProfile. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.SecondaryId secondaryId, or null if not present + */ + @Nullable SecondaryId getSecondaryId(); + + @Override + DependenciesKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/DependenciesBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/DependenciesBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..1b96db5be6a2888c7fa11ab52d93e7df515a1e57 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/DependenciesBuilder.java @@ -0,0 +1,296 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.PrimaryId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.SecondaryId; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link DependenciesBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     DependenciesBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new DependenciesBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of DependenciesBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see DependenciesBuilder + * @see Builder + * + */ +public class DependenciesBuilder implements Builder { + + private String _id; + private PrimaryId _primaryId; + private SecondaryId _secondaryId; + private DependenciesKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public DependenciesBuilder() { + } + + public DependenciesBuilder(Dependencies base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._primaryId = base.getPrimaryId(); + this._secondaryId = base.getSecondaryId(); + } + + + public DependenciesKey key() { + return key; + } + + public String getId() { + return _id; + } + + public PrimaryId getPrimaryId() { + return _primaryId; + } + + public SecondaryId getSecondaryId() { + return _secondaryId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public DependenciesBuilder withKey(final DependenciesKey key) { + this.key = key; + return this; + } + + public DependenciesBuilder setId(final String value) { + this._id = value; + return this; + } + + public DependenciesBuilder setPrimaryId(final PrimaryId value) { + this._primaryId = value; + return this; + } + + public DependenciesBuilder setSecondaryId(final SecondaryId value) { + this._secondaryId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public DependenciesBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public DependenciesBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public DependenciesBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private DependenciesBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Dependencies build() { + return new DependenciesImpl(this); + } + + private static final class DependenciesImpl + extends AbstractAugmentable + implements Dependencies { + + private final String _id; + private final PrimaryId _primaryId; + private final SecondaryId _secondaryId; + private final DependenciesKey key; + + DependenciesImpl(DependenciesBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new DependenciesKey(base.getId()); + } + this._id = key.getId(); + this._primaryId = base.getPrimaryId(); + this._secondaryId = base.getSecondaryId(); + } + + @Override + public DependenciesKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public PrimaryId getPrimaryId() { + return _primaryId; + } + + @Override + public SecondaryId getSecondaryId() { + return _secondaryId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_primaryId); + result = prime * result + Objects.hashCode(_secondaryId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Dependencies.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Dependencies other = (Dependencies)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_primaryId, other.getPrimaryId())) { + return false; + } + if (!Objects.equals(_secondaryId, other.getSecondaryId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + DependenciesImpl otherImpl = (DependenciesImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Dependencies"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_primaryId", _primaryId); + CodeHelpers.appendValue(helper, "_secondaryId", _secondaryId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/DependenciesKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/DependenciesKey.java new file mode 100644 index 0000000000000000000000000000000000000000..cd0980f65fd7619a79cb6c00f70caae0a0ec52ad --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/DependenciesKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class DependenciesKey + implements Identifier { + private static final long serialVersionUID = -3074614359735867865L; + private final String _id; + + + public DependenciesKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public DependenciesKey(DependenciesKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DependenciesKey)) { + return false; + } + final DependenciesKey other = (DependenciesKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(DependenciesKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/MonitoredInfo.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/MonitoredInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..4624b0c4130b47a35a9cdcefa852e00a06f743f5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/MonitoredInfo.java @@ -0,0 +1,100 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info.MonitoringParameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info.VnfIndicatorInfo; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list monitored-info {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   container vnf-indicator-info {
+ *     leaf vnfd-id {
+ *       type leafref {
+ *         path ../../../../../vnfd/id;
+ *       }
+ *     }
+ *     leaf vnf-indicator {
+ *       type leafref {
+ *         path deref(../vnfd-id)/../indicator/id;
+ *       }
+ *     }
+ *   }
+ *   container monitoring-parameter {
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf performance-metric {
+ *       type string;
+ *     }
+ *     leaf collection-period {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/monitored-info + * + *

To create instances of this class use {@link MonitoredInfoBuilder}. + * @see MonitoredInfoBuilder + * @see MonitoredInfoKey + * + */ +public interface MonitoredInfo + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("monitored-info"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.MonitoredInfo.class; + } + + /** + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Uniquely identifies this VNF Indicator information element. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info.VnfIndicatorInfo vnfIndicatorInfo, or null if not present + */ + @Nullable VnfIndicatorInfo getVnfIndicatorInfo(); + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info.MonitoringParameter monitoringParameter, or null if not present + */ + @Nullable MonitoringParameter getMonitoringParameter(); + + @Override + MonitoredInfoKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/MonitoredInfoBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/MonitoredInfoBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..62b2f8ecb41b2b7cf9d52a7a578508bf28926476 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/MonitoredInfoBuilder.java @@ -0,0 +1,296 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info.MonitoringParameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info.VnfIndicatorInfo; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link MonitoredInfoBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     MonitoredInfoBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new MonitoredInfoBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of MonitoredInfoBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see MonitoredInfoBuilder + * @see Builder + * + */ +public class MonitoredInfoBuilder implements Builder { + + private String _id; + private MonitoringParameter _monitoringParameter; + private VnfIndicatorInfo _vnfIndicatorInfo; + private MonitoredInfoKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public MonitoredInfoBuilder() { + } + + public MonitoredInfoBuilder(MonitoredInfo base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._monitoringParameter = base.getMonitoringParameter(); + this._vnfIndicatorInfo = base.getVnfIndicatorInfo(); + } + + + public MonitoredInfoKey key() { + return key; + } + + public String getId() { + return _id; + } + + public MonitoringParameter getMonitoringParameter() { + return _monitoringParameter; + } + + public VnfIndicatorInfo getVnfIndicatorInfo() { + return _vnfIndicatorInfo; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public MonitoredInfoBuilder withKey(final MonitoredInfoKey key) { + this.key = key; + return this; + } + + public MonitoredInfoBuilder setId(final String value) { + this._id = value; + return this; + } + + public MonitoredInfoBuilder setMonitoringParameter(final MonitoringParameter value) { + this._monitoringParameter = value; + return this; + } + + public MonitoredInfoBuilder setVnfIndicatorInfo(final VnfIndicatorInfo value) { + this._vnfIndicatorInfo = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public MonitoredInfoBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public MonitoredInfoBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public MonitoredInfoBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private MonitoredInfoBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public MonitoredInfo build() { + return new MonitoredInfoImpl(this); + } + + private static final class MonitoredInfoImpl + extends AbstractAugmentable + implements MonitoredInfo { + + private final String _id; + private final MonitoringParameter _monitoringParameter; + private final VnfIndicatorInfo _vnfIndicatorInfo; + private final MonitoredInfoKey key; + + MonitoredInfoImpl(MonitoredInfoBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new MonitoredInfoKey(base.getId()); + } + this._id = key.getId(); + this._monitoringParameter = base.getMonitoringParameter(); + this._vnfIndicatorInfo = base.getVnfIndicatorInfo(); + } + + @Override + public MonitoredInfoKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public MonitoringParameter getMonitoringParameter() { + return _monitoringParameter; + } + + @Override + public VnfIndicatorInfo getVnfIndicatorInfo() { + return _vnfIndicatorInfo; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_monitoringParameter); + result = prime * result + Objects.hashCode(_vnfIndicatorInfo); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!MonitoredInfo.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + MonitoredInfo other = (MonitoredInfo)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_monitoringParameter, other.getMonitoringParameter())) { + return false; + } + if (!Objects.equals(_vnfIndicatorInfo, other.getVnfIndicatorInfo())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + MonitoredInfoImpl otherImpl = (MonitoredInfoImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("MonitoredInfo"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_monitoringParameter", _monitoringParameter); + CodeHelpers.appendValue(helper, "_vnfIndicatorInfo", _vnfIndicatorInfo); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/MonitoredInfoKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/MonitoredInfoKey.java new file mode 100644 index 0000000000000000000000000000000000000000..0a9d41beaa49a69fab9a21ef02ba0a3ab749879a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/MonitoredInfoKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class MonitoredInfoKey + implements Identifier { + private static final long serialVersionUID = -3390894449966734843L; + private final String _id; + + + public MonitoredInfoKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public MonitoredInfoKey(MonitoredInfoKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof MonitoredInfoKey)) { + return false; + } + final MonitoredInfoKey other = (MonitoredInfoKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(MonitoredInfoKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsInstantiationLevel.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsInstantiationLevel.java new file mode 100644 index 0000000000000000000000000000000000000000..3c358f7c26f9c2ca3de1ac1ac1bb4477d30dd51e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsInstantiationLevel.java @@ -0,0 +1,173 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.NsToLevelMapping; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.NsToLevelMappingKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.VirtualLinkToLevelMapping; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.VirtualLinkToLevelMappingKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.VnfToLevelMapping; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.VnfToLevelMappingKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes the details of an NS level. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list ns-instantiation-level {
+ *   min-elements 1;
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   list vnf-to-level-mapping {
+ *     key vnf-profile-id;
+ *     leaf vnf-profile-id {
+ *       type leafref {
+ *         path ../../../vnf-profile/id;
+ *       }
+ *     }
+ *     leaf number-of-instances {
+ *       default 1;
+ *       type uint32;
+ *     }
+ *   }
+ *   list virtual-link-to-level-mapping {
+ *     key virtual-link-profile-id;
+ *     leaf virtual-link-profile-id {
+ *       type leafref {
+ *         path ../../../virtual-link-profile/id;
+ *       }
+ *     }
+ *     uses link-bitrate-requirements;
+ *   }
+ *   list ns-to-level-mapping {
+ *     key ns-profile-id;
+ *     leaf ns-profile-id {
+ *       type leafref {
+ *         path ../../../ns-profile/id;
+ *       }
+ *     }
+ *     leaf number-of-instances {
+ *       default 1;
+ *       type uint32;
+ *     }
+ *   }
+ *   must "(count(vnf-to-level-mapping) + count(virtual-link-to-level-mapping) + count(ns-to-level-mapping)) > 0" {
+ *     error-message
+ *       "At least one attribute between vnf-to-level-mapping, virtual-link-to-level-mapping and ns-to-level-mapping shall be present.";
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/ns-instantiation-level + * + *

To create instances of this class use {@link NsInstantiationLevelBuilder}. + * @see NsInstantiationLevelBuilder + * @see NsInstantiationLevelKey + * + */ +public interface NsInstantiationLevel + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ns-instantiation-level"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsInstantiationLevel.class; + } + + /** + * Identifier of this NsLevel information element. It uniquely identifies an NS + * level within the DF. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Human readable description of the NS level. + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * Specifies the profile of the VNFs involved in this NS level and, for each of + * them, the required number of instances. + * + * + * + * @return java.util.Map vnfToLevelMapping, or null if not present + */ + @Nullable Map getVnfToLevelMapping(); + + /** + * @return java.util.Map vnfToLevelMapping, or an empty list if it is not present + */ + default @NonNull Map nonnullVnfToLevelMapping() { + return CodeHelpers.nonnull(getVnfToLevelMapping()); + } + + /** + * Specifies the profile of the VLs involved in this NS level and, for each of + * them, the needed bandwidth. + * + * + * + * @return java.util.Map virtualLinkToLevelMapping, or null if not present + */ + @Nullable Map getVirtualLinkToLevelMapping(); + + /** + * @return java.util.Map virtualLinkToLevelMapping, or an empty list if it is not present + */ + default @NonNull Map nonnullVirtualLinkToLevelMapping() { + return CodeHelpers.nonnull(getVirtualLinkToLevelMapping()); + } + + /** + * Specifies the profile of the nested NSs involved in this NS level and, for each + * of them, the required number of instances. + * + * + * + * @return java.util.Map nsToLevelMapping, or null if not present + */ + @Nullable Map getNsToLevelMapping(); + + /** + * @return java.util.Map nsToLevelMapping, or an empty list if it is not present + */ + default @NonNull Map nonnullNsToLevelMapping() { + return CodeHelpers.nonnull(getNsToLevelMapping()); + } + + @Override + NsInstantiationLevelKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsInstantiationLevelBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsInstantiationLevelBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..9bd20c9ede9c6c152c2fb8a962508bb94a9442b3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsInstantiationLevelBuilder.java @@ -0,0 +1,398 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.NsToLevelMapping; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.NsToLevelMappingKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.VirtualLinkToLevelMapping; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.VirtualLinkToLevelMappingKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.VnfToLevelMapping; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.VnfToLevelMappingKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NsInstantiationLevelBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsInstantiationLevelBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsInstantiationLevelBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsInstantiationLevelBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsInstantiationLevelBuilder + * @see Builder + * + */ +public class NsInstantiationLevelBuilder implements Builder { + + private String _description; + private String _id; + private Map _nsToLevelMapping; + private Map _virtualLinkToLevelMapping; + private Map _vnfToLevelMapping; + private NsInstantiationLevelKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsInstantiationLevelBuilder() { + } + + public NsInstantiationLevelBuilder(NsInstantiationLevel base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._description = base.getDescription(); + this._nsToLevelMapping = base.getNsToLevelMapping(); + this._virtualLinkToLevelMapping = base.getVirtualLinkToLevelMapping(); + this._vnfToLevelMapping = base.getVnfToLevelMapping(); + } + + + public NsInstantiationLevelKey key() { + return key; + } + + public String getDescription() { + return _description; + } + + public String getId() { + return _id; + } + + public Map getNsToLevelMapping() { + return _nsToLevelMapping; + } + + public Map getVirtualLinkToLevelMapping() { + return _virtualLinkToLevelMapping; + } + + public Map getVnfToLevelMapping() { + return _vnfToLevelMapping; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public NsInstantiationLevelBuilder withKey(final NsInstantiationLevelKey key) { + this.key = key; + return this; + } + + public NsInstantiationLevelBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public NsInstantiationLevelBuilder setId(final String value) { + this._id = value; + return this; + } + public NsInstantiationLevelBuilder setNsToLevelMapping(final Map values) { + this._nsToLevelMapping = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setNsToLevelMapping(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsInstantiationLevelBuilder setNsToLevelMapping(final List values) { + return setNsToLevelMapping(CodeHelpers.compatMap(values)); + } + public NsInstantiationLevelBuilder setVirtualLinkToLevelMapping(final Map values) { + this._virtualLinkToLevelMapping = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualLinkToLevelMapping(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsInstantiationLevelBuilder setVirtualLinkToLevelMapping(final List values) { + return setVirtualLinkToLevelMapping(CodeHelpers.compatMap(values)); + } + public NsInstantiationLevelBuilder setVnfToLevelMapping(final Map values) { + this._vnfToLevelMapping = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVnfToLevelMapping(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsInstantiationLevelBuilder setVnfToLevelMapping(final List values) { + return setVnfToLevelMapping(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsInstantiationLevelBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsInstantiationLevelBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsInstantiationLevelBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsInstantiationLevelBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public NsInstantiationLevel build() { + return new NsInstantiationLevelImpl(this); + } + + private static final class NsInstantiationLevelImpl + extends AbstractAugmentable + implements NsInstantiationLevel { + + private final String _description; + private final String _id; + private final Map _nsToLevelMapping; + private final Map _virtualLinkToLevelMapping; + private final Map _vnfToLevelMapping; + private final NsInstantiationLevelKey key; + + NsInstantiationLevelImpl(NsInstantiationLevelBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new NsInstantiationLevelKey(base.getId()); + } + this._id = key.getId(); + this._description = base.getDescription(); + this._nsToLevelMapping = CodeHelpers.emptyToNull(base.getNsToLevelMapping()); + this._virtualLinkToLevelMapping = CodeHelpers.emptyToNull(base.getVirtualLinkToLevelMapping()); + this._vnfToLevelMapping = CodeHelpers.emptyToNull(base.getVnfToLevelMapping()); + } + + @Override + public NsInstantiationLevelKey key() { + return key; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getNsToLevelMapping() { + return _nsToLevelMapping; + } + + @Override + public Map getVirtualLinkToLevelMapping() { + return _virtualLinkToLevelMapping; + } + + @Override + public Map getVnfToLevelMapping() { + return _vnfToLevelMapping; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_nsToLevelMapping); + result = prime * result + Objects.hashCode(_virtualLinkToLevelMapping); + result = prime * result + Objects.hashCode(_vnfToLevelMapping); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!NsInstantiationLevel.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + NsInstantiationLevel other = (NsInstantiationLevel)obj; + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_nsToLevelMapping, other.getNsToLevelMapping())) { + return false; + } + if (!Objects.equals(_virtualLinkToLevelMapping, other.getVirtualLinkToLevelMapping())) { + return false; + } + if (!Objects.equals(_vnfToLevelMapping, other.getVnfToLevelMapping())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsInstantiationLevelImpl otherImpl = (NsInstantiationLevelImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("NsInstantiationLevel"); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_nsToLevelMapping", _nsToLevelMapping); + CodeHelpers.appendValue(helper, "_virtualLinkToLevelMapping", _virtualLinkToLevelMapping); + CodeHelpers.appendValue(helper, "_vnfToLevelMapping", _vnfToLevelMapping); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsInstantiationLevelKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsInstantiationLevelKey.java new file mode 100644 index 0000000000000000000000000000000000000000..8e7bbaf8057d455b8cc5a9cebc98b12b7861b4da --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsInstantiationLevelKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class NsInstantiationLevelKey + implements Identifier { + private static final long serialVersionUID = -4181296861555412040L; + private final String _id; + + + public NsInstantiationLevelKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public NsInstantiationLevelKey(NsInstantiationLevelKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof NsInstantiationLevelKey)) { + return false; + } + final NsInstantiationLevelKey other = (NsInstantiationLevelKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(NsInstantiationLevelKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..d4f852c2f809fb2d8d81798de11756cfef615146 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsProfile.java @@ -0,0 +1,208 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.AffinityOrAntiAffinityGroupId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.AffinityOrAntiAffinityGroupIdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.VirtualLinkConnectivity; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.VirtualLinkConnectivityKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Specifies a NS Profile supported by this NS DF. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list ns-profile {
+ *   must "min-number-of-instances <= max-number-of-instances" {
+ *     error-message
+ *       "min-number-of-instances has to be less than or equalmax-number-of-instances.";
+ *   }
+ *   must boolean(../../nested-nsd-id[.=current()/nsd-id]) {
+ *     error-message
+ *       "PNFDs in the profile has to be listed as a dependency of the network service descriptor.";
+ *   }
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf nsd-id {
+ *     type leafref {
+ *       path ../../../../nsd/id;
+ *     }
+ *   }
+ *   leaf ns-df-id {
+ *     type leafref {
+ *       path deref(../nsd-id)/../df/id;
+ *     }
+ *   }
+ *   leaf instantiation-level-id {
+ *     type leafref {
+ *       path deref(../ns-df-id)/../ns-instantiation-level/id;
+ *     }
+ *   }
+ *   leaf min-number-of-instances {
+ *     type uint16;
+ *     default 1;
+ *   }
+ *   leaf max-number-of-instances {
+ *     type uint16;
+ *     default 1;
+ *   }
+ *   list affinity-or-anti-affinity-group-id {
+ *     key id;
+ *     leaf id {
+ *       type leafref {
+ *         path ../../../affinity-or-anti-affinity-group/id;
+ *       }
+ *     }
+ *   }
+ *   list virtual-link-connectivity {
+ *     key virtual-link-profile-id;
+ *     leaf virtual-link-profile-id {
+ *       type leafref {
+ *         path ../../../virtual-link-profile/id;
+ *       }
+ *     }
+ *     list constituent-cpd-id {
+ *       key constituent-base-element-id;
+ *       leaf constituent-base-element-id {
+ *         type leafref {
+ *           path ../../../id;
+ *         }
+ *       }
+ *       leaf constituent-cpd-id {
+ *         type leafref {
+ *           path deref(../../../nsd-id)/../sapd/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/ns-profile + * + *

To create instances of this class use {@link NsProfileBuilder}. + * @see NsProfileBuilder + * @see NsProfileKey + * + */ +public interface NsProfile + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ns-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsProfile.class; + } + + /** + * Identifies an NS profile. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Identifies the NSD applicable to NS instantiated according to this profile. + * + * + * + * @return java.lang.String nsdId, or null if not present + */ + @Nullable String getNsdId(); + + /** + * Identifies the applicable network service DF within the scope of the NSD. + * + * + * + * @return java.lang.String nsDfId, or null if not present + */ + @Nullable String getNsDfId(); + + /** + * Identifies the NS level within the referenced NS DF to be used in the context of + * the parent NS instantiation. If not present, the default NS instantiation level + * as declared in the referenced NSD shall be used. + * + * + * + * @return java.lang.String instantiationLevelId, or null if not present + */ + @Nullable String getInstantiationLevelId(); + + /** + * Minimum number of nested NS instances based on the referenced NSD that is + * permitted to exist for this NsProfile. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 minNumberOfInstances, or null if not present + */ + @Nullable Uint16 getMinNumberOfInstances(); + + /** + * Maximum number of nested NS instances based on the referenced NSD that is + * permitted to exist for this NsProfile. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 maxNumberOfInstances, or null if not present + */ + @Nullable Uint16 getMaxNumberOfInstances(); + + /** + * Identifies an affinity or anti-affinity group the NSs created according to this + * NsProfile belongs to. + * + * + * + * @return java.util.Map affinityOrAntiAffinityGroupId, or null if not present + */ + @Nullable Map getAffinityOrAntiAffinityGroupId(); + + /** + * @return java.util.Map affinityOrAntiAffinityGroupId, or an empty list if it is not present + */ + default @NonNull Map nonnullAffinityOrAntiAffinityGroupId() { + return CodeHelpers.nonnull(getAffinityOrAntiAffinityGroupId()); + } + + /** + * @return java.util.Map virtualLinkConnectivity, or null if not present + */ + @Nullable Map getVirtualLinkConnectivity(); + + /** + * @return java.util.Map virtualLinkConnectivity, or an empty list if it is not present + */ + default @NonNull Map nonnullVirtualLinkConnectivity() { + return CodeHelpers.nonnull(getVirtualLinkConnectivity()); + } + + @Override + NsProfileKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..c97ef61ed4e9b76c7a1ddccc6af67b782a3afb99 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsProfileBuilder.java @@ -0,0 +1,474 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Integer; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.AffinityOrAntiAffinityGroupId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.AffinityOrAntiAffinityGroupIdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.VirtualLinkConnectivity; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.VirtualLinkConnectivityKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Class that builds {@link NsProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsProfileBuilder + * @see Builder + * + */ +public class NsProfileBuilder implements Builder { + + private Map _affinityOrAntiAffinityGroupId; + private String _id; + private String _instantiationLevelId; + private Uint16 _maxNumberOfInstances; + private Uint16 _minNumberOfInstances; + private String _nsDfId; + private String _nsdId; + private Map _virtualLinkConnectivity; + private NsProfileKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsProfileBuilder() { + } + + public NsProfileBuilder(NsProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._affinityOrAntiAffinityGroupId = base.getAffinityOrAntiAffinityGroupId(); + this._instantiationLevelId = base.getInstantiationLevelId(); + this._maxNumberOfInstances = base.getMaxNumberOfInstances(); + this._minNumberOfInstances = base.getMinNumberOfInstances(); + this._nsDfId = base.getNsDfId(); + this._nsdId = base.getNsdId(); + this._virtualLinkConnectivity = base.getVirtualLinkConnectivity(); + } + + + public NsProfileKey key() { + return key; + } + + public Map getAffinityOrAntiAffinityGroupId() { + return _affinityOrAntiAffinityGroupId; + } + + public String getId() { + return _id; + } + + public String getInstantiationLevelId() { + return _instantiationLevelId; + } + + public Uint16 getMaxNumberOfInstances() { + return _maxNumberOfInstances; + } + + public Uint16 getMinNumberOfInstances() { + return _minNumberOfInstances; + } + + public String getNsDfId() { + return _nsDfId; + } + + public String getNsdId() { + return _nsdId; + } + + public Map getVirtualLinkConnectivity() { + return _virtualLinkConnectivity; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public NsProfileBuilder withKey(final NsProfileKey key) { + this.key = key; + return this; + } + public NsProfileBuilder setAffinityOrAntiAffinityGroupId(final Map values) { + this._affinityOrAntiAffinityGroupId = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setAffinityOrAntiAffinityGroupId(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsProfileBuilder setAffinityOrAntiAffinityGroupId(final List values) { + return setAffinityOrAntiAffinityGroupId(CodeHelpers.compatMap(values)); + } + + public NsProfileBuilder setId(final String value) { + this._id = value; + return this; + } + + public NsProfileBuilder setInstantiationLevelId(final String value) { + this._instantiationLevelId = value; + return this; + } + + public NsProfileBuilder setMaxNumberOfInstances(final Uint16 value) { + this._maxNumberOfInstances = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setMaxNumberOfInstances(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public NsProfileBuilder setMaxNumberOfInstances(final Integer value) { + return setMaxNumberOfInstances(CodeHelpers.compatUint(value)); + } + + public NsProfileBuilder setMinNumberOfInstances(final Uint16 value) { + this._minNumberOfInstances = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setMinNumberOfInstances(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public NsProfileBuilder setMinNumberOfInstances(final Integer value) { + return setMinNumberOfInstances(CodeHelpers.compatUint(value)); + } + + public NsProfileBuilder setNsDfId(final String value) { + this._nsDfId = value; + return this; + } + + public NsProfileBuilder setNsdId(final String value) { + this._nsdId = value; + return this; + } + public NsProfileBuilder setVirtualLinkConnectivity(final Map values) { + this._virtualLinkConnectivity = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualLinkConnectivity(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsProfileBuilder setVirtualLinkConnectivity(final List values) { + return setVirtualLinkConnectivity(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public NsProfile build() { + return new NsProfileImpl(this); + } + + private static final class NsProfileImpl + extends AbstractAugmentable + implements NsProfile { + + private final Map _affinityOrAntiAffinityGroupId; + private final String _id; + private final String _instantiationLevelId; + private final Uint16 _maxNumberOfInstances; + private final Uint16 _minNumberOfInstances; + private final String _nsDfId; + private final String _nsdId; + private final Map _virtualLinkConnectivity; + private final NsProfileKey key; + + NsProfileImpl(NsProfileBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new NsProfileKey(base.getId()); + } + this._id = key.getId(); + this._affinityOrAntiAffinityGroupId = CodeHelpers.emptyToNull(base.getAffinityOrAntiAffinityGroupId()); + this._instantiationLevelId = base.getInstantiationLevelId(); + this._maxNumberOfInstances = base.getMaxNumberOfInstances(); + this._minNumberOfInstances = base.getMinNumberOfInstances(); + this._nsDfId = base.getNsDfId(); + this._nsdId = base.getNsdId(); + this._virtualLinkConnectivity = CodeHelpers.emptyToNull(base.getVirtualLinkConnectivity()); + } + + @Override + public NsProfileKey key() { + return key; + } + + @Override + public Map getAffinityOrAntiAffinityGroupId() { + return _affinityOrAntiAffinityGroupId; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getInstantiationLevelId() { + return _instantiationLevelId; + } + + @Override + public Uint16 getMaxNumberOfInstances() { + return _maxNumberOfInstances; + } + + @Override + public Uint16 getMinNumberOfInstances() { + return _minNumberOfInstances; + } + + @Override + public String getNsDfId() { + return _nsDfId; + } + + @Override + public String getNsdId() { + return _nsdId; + } + + @Override + public Map getVirtualLinkConnectivity() { + return _virtualLinkConnectivity; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_affinityOrAntiAffinityGroupId); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_instantiationLevelId); + result = prime * result + Objects.hashCode(_maxNumberOfInstances); + result = prime * result + Objects.hashCode(_minNumberOfInstances); + result = prime * result + Objects.hashCode(_nsDfId); + result = prime * result + Objects.hashCode(_nsdId); + result = prime * result + Objects.hashCode(_virtualLinkConnectivity); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!NsProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + NsProfile other = (NsProfile)obj; + if (!Objects.equals(_affinityOrAntiAffinityGroupId, other.getAffinityOrAntiAffinityGroupId())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_instantiationLevelId, other.getInstantiationLevelId())) { + return false; + } + if (!Objects.equals(_maxNumberOfInstances, other.getMaxNumberOfInstances())) { + return false; + } + if (!Objects.equals(_minNumberOfInstances, other.getMinNumberOfInstances())) { + return false; + } + if (!Objects.equals(_nsDfId, other.getNsDfId())) { + return false; + } + if (!Objects.equals(_nsdId, other.getNsdId())) { + return false; + } + if (!Objects.equals(_virtualLinkConnectivity, other.getVirtualLinkConnectivity())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsProfileImpl otherImpl = (NsProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("NsProfile"); + CodeHelpers.appendValue(helper, "_affinityOrAntiAffinityGroupId", _affinityOrAntiAffinityGroupId); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_instantiationLevelId", _instantiationLevelId); + CodeHelpers.appendValue(helper, "_maxNumberOfInstances", _maxNumberOfInstances); + CodeHelpers.appendValue(helper, "_minNumberOfInstances", _minNumberOfInstances); + CodeHelpers.appendValue(helper, "_nsDfId", _nsDfId); + CodeHelpers.appendValue(helper, "_nsdId", _nsdId); + CodeHelpers.appendValue(helper, "_virtualLinkConnectivity", _virtualLinkConnectivity); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsProfileKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsProfileKey.java new file mode 100644 index 0000000000000000000000000000000000000000..29c568306c408115d67e4e419ae71de3f79d8aaa --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/NsProfileKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class NsProfileKey + implements Identifier { + private static final long serialVersionUID = 5077089461983925448L; + private final String _id; + + + public NsProfileKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public NsProfileKey(NsProfileKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof NsProfileKey)) { + return false; + } + final NsProfileKey other = (NsProfileKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(NsProfileKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/PnfProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/PnfProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..85b64e5403fe535249becaf6ad44936ab97eb83e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/PnfProfile.java @@ -0,0 +1,123 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.VirtualLinkConnectivity; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.VirtualLinkConnectivityKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list pnf-profile {
+ *   key id;
+ *   must boolean(../../pnfd-id[.=current()/pnfd-id]) {
+ *     error-message
+ *       "PNFDs in the profile has to be listed as a dependency of the network service descriptor.";
+ *   }
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf pnfd-id {
+ *     type leafref {
+ *       path ../../../../pnfd/id;
+ *     }
+ *   }
+ *   list virtual-link-connectivity {
+ *     key virtual-link-profile-id;
+ *     leaf virtual-link-profile-id {
+ *       type leafref {
+ *         path ../../../virtual-link-profile/id;
+ *       }
+ *     }
+ *     list constituent-cpd-id {
+ *       key constituent-base-element-id;
+ *       leaf constituent-base-element-id {
+ *         type leafref {
+ *           path ../../../id;
+ *         }
+ *       }
+ *       leaf constituent-cpd-id {
+ *         type leafref {
+ *           path deref(../../../pnfd-id)/../ext-cpd/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/pnf-profile + * + *

To create instances of this class use {@link PnfProfileBuilder}. + * @see PnfProfileBuilder + * @see PnfProfileKey + * + */ +public interface PnfProfile + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pnf-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.PnfProfile.class; + } + + /** + * Identifier of this PnfProfile information element. It uniquely identifies a + * PnfProfile. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * References a PNFD. + * + * + * + * @return java.lang.String pnfdId, or null if not present + */ + @Nullable String getPnfdId(); + + /** + * Defines the connection information of the PNF, it contains connection + * relationship between a PNF connection point and a NS Virtual Link. + * + * + * + * @return java.util.Map virtualLinkConnectivity, or null if not present + */ + @Nullable Map getVirtualLinkConnectivity(); + + /** + * @return java.util.Map virtualLinkConnectivity, or an empty list if it is not present + */ + default @NonNull Map nonnullVirtualLinkConnectivity() { + return CodeHelpers.nonnull(getVirtualLinkConnectivity()); + } + + @Override + PnfProfileKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/PnfProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/PnfProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..e6f61b6837fe1fbca37abb49287d142daa3fdc74 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/PnfProfileBuilder.java @@ -0,0 +1,314 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.VirtualLinkConnectivity; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.VirtualLinkConnectivityKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PnfProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PnfProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PnfProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PnfProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PnfProfileBuilder + * @see Builder + * + */ +public class PnfProfileBuilder implements Builder { + + private String _id; + private String _pnfdId; + private Map _virtualLinkConnectivity; + private PnfProfileKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PnfProfileBuilder() { + } + + public PnfProfileBuilder(PnfProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._pnfdId = base.getPnfdId(); + this._virtualLinkConnectivity = base.getVirtualLinkConnectivity(); + } + + + public PnfProfileKey key() { + return key; + } + + public String getId() { + return _id; + } + + public String getPnfdId() { + return _pnfdId; + } + + public Map getVirtualLinkConnectivity() { + return _virtualLinkConnectivity; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public PnfProfileBuilder withKey(final PnfProfileKey key) { + this.key = key; + return this; + } + + public PnfProfileBuilder setId(final String value) { + this._id = value; + return this; + } + + public PnfProfileBuilder setPnfdId(final String value) { + this._pnfdId = value; + return this; + } + public PnfProfileBuilder setVirtualLinkConnectivity(final Map values) { + this._virtualLinkConnectivity = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualLinkConnectivity(Map)} instead. + */ + @Deprecated(forRemoval = true) + public PnfProfileBuilder setVirtualLinkConnectivity(final List values) { + return setVirtualLinkConnectivity(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PnfProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PnfProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PnfProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PnfProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public PnfProfile build() { + return new PnfProfileImpl(this); + } + + private static final class PnfProfileImpl + extends AbstractAugmentable + implements PnfProfile { + + private final String _id; + private final String _pnfdId; + private final Map _virtualLinkConnectivity; + private final PnfProfileKey key; + + PnfProfileImpl(PnfProfileBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new PnfProfileKey(base.getId()); + } + this._id = key.getId(); + this._pnfdId = base.getPnfdId(); + this._virtualLinkConnectivity = CodeHelpers.emptyToNull(base.getVirtualLinkConnectivity()); + } + + @Override + public PnfProfileKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getPnfdId() { + return _pnfdId; + } + + @Override + public Map getVirtualLinkConnectivity() { + return _virtualLinkConnectivity; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_pnfdId); + result = prime * result + Objects.hashCode(_virtualLinkConnectivity); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!PnfProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + PnfProfile other = (PnfProfile)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_pnfdId, other.getPnfdId())) { + return false; + } + if (!Objects.equals(_virtualLinkConnectivity, other.getVirtualLinkConnectivity())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PnfProfileImpl otherImpl = (PnfProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("PnfProfile"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_pnfdId", _pnfdId); + CodeHelpers.appendValue(helper, "_virtualLinkConnectivity", _virtualLinkConnectivity); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/PnfProfileKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/PnfProfileKey.java new file mode 100644 index 0000000000000000000000000000000000000000..aaf8e8efe53a0225a1adbaa5945345769886af52 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/PnfProfileKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class PnfProfileKey + implements Identifier { + private static final long serialVersionUID = 944242176321633264L; + private final String _id; + + + public PnfProfileKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public PnfProfileKey(PnfProfileKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof PnfProfileKey)) { + return false; + } + final PnfProfileKey other = (PnfProfileKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(PnfProfileKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ScalingAspect.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ScalingAspect.java new file mode 100644 index 0000000000000000000000000000000000000000..66f476894abc9c2470304f52d8723cf0b6c27931 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ScalingAspect.java @@ -0,0 +1,102 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The scaling aspects supported by this DF of the NS. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list scaling-aspect {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   leaf scaling-level {
+ *     type leafref {
+ *       path ../../ns-instantiation-level/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/scaling-aspect + * + *

To create instances of this class use {@link ScalingAspectBuilder}. + * @see ScalingAspectBuilder + * @see ScalingAspectKey + * + */ +public interface ScalingAspect + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("scaling-aspect"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ScalingAspect.class; + } + + /** + * Identifier of this NsScalingAspect information element. It uniquely identifies + * the NS scaling aspect in an NSD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Provides a human readable name of the NS scaling aspect. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Provides a human readable description of the NS scaling aspect. + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * Describes the details of an NS level. + * + * + * + * @return java.lang.String scalingLevel, or null if not present + */ + @Nullable String getScalingLevel(); + + @Override + ScalingAspectKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ScalingAspectBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ScalingAspectBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..139601d920eda956c59c74c7c244acf1de813310 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ScalingAspectBuilder.java @@ -0,0 +1,317 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ScalingAspectBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ScalingAspectBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ScalingAspectBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ScalingAspectBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ScalingAspectBuilder + * @see Builder + * + */ +public class ScalingAspectBuilder implements Builder { + + private String _description; + private String _id; + private String _name; + private String _scalingLevel; + private ScalingAspectKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ScalingAspectBuilder() { + } + + public ScalingAspectBuilder(ScalingAspect base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._description = base.getDescription(); + this._name = base.getName(); + this._scalingLevel = base.getScalingLevel(); + } + + + public ScalingAspectKey key() { + return key; + } + + public String getDescription() { + return _description; + } + + public String getId() { + return _id; + } + + public String getName() { + return _name; + } + + public String getScalingLevel() { + return _scalingLevel; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ScalingAspectBuilder withKey(final ScalingAspectKey key) { + this.key = key; + return this; + } + + public ScalingAspectBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public ScalingAspectBuilder setId(final String value) { + this._id = value; + return this; + } + + public ScalingAspectBuilder setName(final String value) { + this._name = value; + return this; + } + + public ScalingAspectBuilder setScalingLevel(final String value) { + this._scalingLevel = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ScalingAspectBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ScalingAspectBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ScalingAspectBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ScalingAspectBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ScalingAspect build() { + return new ScalingAspectImpl(this); + } + + private static final class ScalingAspectImpl + extends AbstractAugmentable + implements ScalingAspect { + + private final String _description; + private final String _id; + private final String _name; + private final String _scalingLevel; + private final ScalingAspectKey key; + + ScalingAspectImpl(ScalingAspectBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ScalingAspectKey(base.getId()); + } + this._id = key.getId(); + this._description = base.getDescription(); + this._name = base.getName(); + this._scalingLevel = base.getScalingLevel(); + } + + @Override + public ScalingAspectKey key() { + return key; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getName() { + return _name; + } + + @Override + public String getScalingLevel() { + return _scalingLevel; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_scalingLevel); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ScalingAspect.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ScalingAspect other = (ScalingAspect)obj; + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_scalingLevel, other.getScalingLevel())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ScalingAspectImpl otherImpl = (ScalingAspectImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ScalingAspect"); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_scalingLevel", _scalingLevel); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ScalingAspectKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ScalingAspectKey.java new file mode 100644 index 0000000000000000000000000000000000000000..f82c6b420f61ba4739a1efbfadae1aadd9517bed --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ScalingAspectKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ScalingAspectKey + implements Identifier { + private static final long serialVersionUID = 2014464420224184770L; + private final String _id; + + + public ScalingAspectKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ScalingAspectKey(ScalingAspectKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ScalingAspectKey)) { + return false; + } + final ScalingAspectKey other = (ScalingAspectKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ScalingAspectKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VirtualLinkProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VirtualLinkProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..01cf3f9b422222677d88b4975d40d3eeee6fce74 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VirtualLinkProfile.java @@ -0,0 +1,151 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.MaxBitrateRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.MinBitrateRequirements; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * VL profile to be used for the NS flavour. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list virtual-link-profile {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf virtual-link-desc-id {
+ *     type leafref {
+ *       path ../../../virtual-link-desc/id;
+ *     }
+ *   }
+ *   leaf flavour-id {
+ *     type leafref {
+ *       path deref(../virtual-link-desc-id)/../df/id;
+ *     }
+ *   }
+ *   uses local-affinity-or-anti-affinity-rule;
+ *   list affinity-or-anti-affinity-group {
+ *     key id;
+ *     leaf id {
+ *       type leafref {
+ *         path ../../../affinity-or-anti-affinity-group/id;
+ *       }
+ *     }
+ *   }
+ *   container max-bitrate-requirements {
+ *     uses link-bitrate-requirements;
+ *   }
+ *   container min-bitrate-requirements {
+ *     uses link-bitrate-requirements;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/virtual-link-profile + * + *

To create instances of this class use {@link VirtualLinkProfileBuilder}. + * @see VirtualLinkProfileBuilder + * @see VirtualLinkProfileKey + * + */ +public interface VirtualLinkProfile + extends + ChildOf, + Augmentable, + LocalAffinityOrAntiAffinityRule, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-link-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VirtualLinkProfile.class; + } + + /** + * Uniquely identifies this VirtualLinkProfile information element. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Uniquely references a VLD. + * + * + * + * @return java.lang.String virtualLinkDescId, or null if not present + */ + @Nullable String getVirtualLinkDescId(); + + /** + * Identifies a flavour within the VLD. + * + * + * + * @return java.lang.String flavourId, or null if not present + */ + @Nullable String getFlavourId(); + + /** + * Identifies an affinity or anti-affinity group the VLs instantiated according to + * the VlProfile belong to. + * + * + * + * @return java.util.Map affinityOrAntiAffinityGroup, or null if not present + */ + @Nullable Map getAffinityOrAntiAffinityGroup(); + + /** + * @return java.util.Map affinityOrAntiAffinityGroup, or an empty list if it is not present + */ + default @NonNull Map nonnullAffinityOrAntiAffinityGroup() { + return CodeHelpers.nonnull(getAffinityOrAntiAffinityGroup()); + } + + /** + * Specifies the maximum bitrate requirements for a VL instantiated according to + * this profile. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.MaxBitrateRequirements maxBitrateRequirements, or null if not present + */ + @Nullable MaxBitrateRequirements getMaxBitrateRequirements(); + + /** + * Specifies the minimum bitrate requirements for a VL instantiated according to + * this profile. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.MinBitrateRequirements minBitrateRequirements, or null if not present + */ + @Nullable MinBitrateRequirements getMinBitrateRequirements(); + + @Override + VirtualLinkProfileKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VirtualLinkProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VirtualLinkProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..670a9ee1ea6aa7302752c9327b376045a8609ec6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VirtualLinkProfileBuilder.java @@ -0,0 +1,447 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule.LocalAffinityOrAntiAffinityRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule.LocalAffinityOrAntiAffinityRuleKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.MaxBitrateRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.MinBitrateRequirements; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualLinkProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkProfileBuilder + * @see Builder + * + */ +public class VirtualLinkProfileBuilder implements Builder { + + private Map _affinityOrAntiAffinityGroup; + private String _flavourId; + private String _id; + private Map _localAffinityOrAntiAffinityRule; + private MaxBitrateRequirements _maxBitrateRequirements; + private MinBitrateRequirements _minBitrateRequirements; + private String _virtualLinkDescId; + private VirtualLinkProfileKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualLinkProfileBuilder() { + } + public VirtualLinkProfileBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule arg) { + this._localAffinityOrAntiAffinityRule = arg.getLocalAffinityOrAntiAffinityRule(); + } + + public VirtualLinkProfileBuilder(VirtualLinkProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._affinityOrAntiAffinityGroup = base.getAffinityOrAntiAffinityGroup(); + this._flavourId = base.getFlavourId(); + this._localAffinityOrAntiAffinityRule = base.getLocalAffinityOrAntiAffinityRule(); + this._maxBitrateRequirements = base.getMaxBitrateRequirements(); + this._minBitrateRequirements = base.getMinBitrateRequirements(); + this._virtualLinkDescId = base.getVirtualLinkDescId(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule) { + this._localAffinityOrAntiAffinityRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule)arg).getLocalAffinityOrAntiAffinityRule(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule]"); + } + + public VirtualLinkProfileKey key() { + return key; + } + + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + public String getFlavourId() { + return _flavourId; + } + + public String getId() { + return _id; + } + + public Map getLocalAffinityOrAntiAffinityRule() { + return _localAffinityOrAntiAffinityRule; + } + + public MaxBitrateRequirements getMaxBitrateRequirements() { + return _maxBitrateRequirements; + } + + public MinBitrateRequirements getMinBitrateRequirements() { + return _minBitrateRequirements; + } + + public String getVirtualLinkDescId() { + return _virtualLinkDescId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VirtualLinkProfileBuilder withKey(final VirtualLinkProfileKey key) { + this.key = key; + return this; + } + public VirtualLinkProfileBuilder setAffinityOrAntiAffinityGroup(final Map values) { + this._affinityOrAntiAffinityGroup = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setAffinityOrAntiAffinityGroup(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkProfileBuilder setAffinityOrAntiAffinityGroup(final List values) { + return setAffinityOrAntiAffinityGroup(CodeHelpers.compatMap(values)); + } + + public VirtualLinkProfileBuilder setFlavourId(final String value) { + this._flavourId = value; + return this; + } + + public VirtualLinkProfileBuilder setId(final String value) { + this._id = value; + return this; + } + public VirtualLinkProfileBuilder setLocalAffinityOrAntiAffinityRule(final Map values) { + this._localAffinityOrAntiAffinityRule = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setLocalAffinityOrAntiAffinityRule(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkProfileBuilder setLocalAffinityOrAntiAffinityRule(final List values) { + return setLocalAffinityOrAntiAffinityRule(CodeHelpers.compatMap(values)); + } + + public VirtualLinkProfileBuilder setMaxBitrateRequirements(final MaxBitrateRequirements value) { + this._maxBitrateRequirements = value; + return this; + } + + public VirtualLinkProfileBuilder setMinBitrateRequirements(final MinBitrateRequirements value) { + this._minBitrateRequirements = value; + return this; + } + + public VirtualLinkProfileBuilder setVirtualLinkDescId(final String value) { + this._virtualLinkDescId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualLinkProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualLinkProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualLinkProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualLinkProfile build() { + return new VirtualLinkProfileImpl(this); + } + + private static final class VirtualLinkProfileImpl + extends AbstractAugmentable + implements VirtualLinkProfile { + + private final Map _affinityOrAntiAffinityGroup; + private final String _flavourId; + private final String _id; + private final Map _localAffinityOrAntiAffinityRule; + private final MaxBitrateRequirements _maxBitrateRequirements; + private final MinBitrateRequirements _minBitrateRequirements; + private final String _virtualLinkDescId; + private final VirtualLinkProfileKey key; + + VirtualLinkProfileImpl(VirtualLinkProfileBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VirtualLinkProfileKey(base.getId()); + } + this._id = key.getId(); + this._affinityOrAntiAffinityGroup = CodeHelpers.emptyToNull(base.getAffinityOrAntiAffinityGroup()); + this._flavourId = base.getFlavourId(); + this._localAffinityOrAntiAffinityRule = CodeHelpers.emptyToNull(base.getLocalAffinityOrAntiAffinityRule()); + this._maxBitrateRequirements = base.getMaxBitrateRequirements(); + this._minBitrateRequirements = base.getMinBitrateRequirements(); + this._virtualLinkDescId = base.getVirtualLinkDescId(); + } + + @Override + public VirtualLinkProfileKey key() { + return key; + } + + @Override + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + @Override + public String getFlavourId() { + return _flavourId; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getLocalAffinityOrAntiAffinityRule() { + return _localAffinityOrAntiAffinityRule; + } + + @Override + public MaxBitrateRequirements getMaxBitrateRequirements() { + return _maxBitrateRequirements; + } + + @Override + public MinBitrateRequirements getMinBitrateRequirements() { + return _minBitrateRequirements; + } + + @Override + public String getVirtualLinkDescId() { + return _virtualLinkDescId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_affinityOrAntiAffinityGroup); + result = prime * result + Objects.hashCode(_flavourId); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_localAffinityOrAntiAffinityRule); + result = prime * result + Objects.hashCode(_maxBitrateRequirements); + result = prime * result + Objects.hashCode(_minBitrateRequirements); + result = prime * result + Objects.hashCode(_virtualLinkDescId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkProfile other = (VirtualLinkProfile)obj; + if (!Objects.equals(_affinityOrAntiAffinityGroup, other.getAffinityOrAntiAffinityGroup())) { + return false; + } + if (!Objects.equals(_flavourId, other.getFlavourId())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_localAffinityOrAntiAffinityRule, other.getLocalAffinityOrAntiAffinityRule())) { + return false; + } + if (!Objects.equals(_maxBitrateRequirements, other.getMaxBitrateRequirements())) { + return false; + } + if (!Objects.equals(_minBitrateRequirements, other.getMinBitrateRequirements())) { + return false; + } + if (!Objects.equals(_virtualLinkDescId, other.getVirtualLinkDescId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualLinkProfileImpl otherImpl = (VirtualLinkProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkProfile"); + CodeHelpers.appendValue(helper, "_affinityOrAntiAffinityGroup", _affinityOrAntiAffinityGroup); + CodeHelpers.appendValue(helper, "_flavourId", _flavourId); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_localAffinityOrAntiAffinityRule", _localAffinityOrAntiAffinityRule); + CodeHelpers.appendValue(helper, "_maxBitrateRequirements", _maxBitrateRequirements); + CodeHelpers.appendValue(helper, "_minBitrateRequirements", _minBitrateRequirements); + CodeHelpers.appendValue(helper, "_virtualLinkDescId", _virtualLinkDescId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VirtualLinkProfileKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VirtualLinkProfileKey.java new file mode 100644 index 0000000000000000000000000000000000000000..5740e6f202912492b70944ecf92c4f4be7c73fa8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VirtualLinkProfileKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VirtualLinkProfileKey + implements Identifier { + private static final long serialVersionUID = 148998297787905589L; + private final String _id; + + + public VirtualLinkProfileKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VirtualLinkProfileKey(VirtualLinkProfileKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VirtualLinkProfileKey)) { + return false; + } + final VirtualLinkProfileKey other = (VirtualLinkProfileKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VirtualLinkProfileKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VnfProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VnfProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..bd849a0b7a1d9488529abc69723df9d62fb71d66 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VnfProfile.java @@ -0,0 +1,222 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.NsdBuilder.NsdImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VnfProfileBuilder.VnfProfileImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.VirtualLinkConnectivity; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.VirtualLinkConnectivityKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint16; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * VNF profile to be used for the NS flavour. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list vnf-profile {
+ *   must "min-number-of-instances <= max-number-of-instances";
+ *   must boolean(../../vnfd-id[.=current()/vnfd-id]) {
+ *     error-message
+ *       "VNFDs in the profile has to be listed as a dependency of the network service descriptor.";
+ *   }
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf vnfd-id {
+ *     type leafref {
+ *       path ../../../../vnfd/id;
+ *     }
+ *   }
+ *   leaf flavour-id {
+ *     type leafref {
+ *       path deref(../vnfd-id)/../df/id;
+ *     }
+ *   }
+ *   leaf instantiation-level {
+ *     type leafref {
+ *       path deref(../flavour-id)/../instantiation-level/id;
+ *     }
+ *   }
+ *   leaf min-number-of-instances {
+ *     default 1;
+ *     type uint16;
+ *   }
+ *   leaf max-number-of-instances {
+ *     default 1;
+ *     type uint16;
+ *   }
+ *   uses local-affinity-or-anti-affinity-rule;
+ *   list affinity-or-anti-affinity-group {
+ *     key id;
+ *     leaf id {
+ *       type leafref {
+ *         path ../../../affinity-or-anti-affinity-group/id;
+ *       }
+ *     }
+ *   }
+ *   list virtual-link-connectivity {
+ *     key virtual-link-profile-id;
+ *     leaf virtual-link-profile-id {
+ *       type leafref {
+ *         path ../../../virtual-link-profile/id;
+ *       }
+ *     }
+ *     list constituent-cpd-id {
+ *       key constituent-base-element-id;
+ *       leaf constituent-base-element-id {
+ *         type leafref {
+ *           path ../../../id;
+ *         }
+ *       }
+ *       leaf constituent-cpd-id {
+ *         type leafref {
+ *           path deref(../../../vnfd-id)/../ext-cpd/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/vnf-profile + * + *

To create instances of this class use {@link VnfProfileBuilder}. + * @see VnfProfileBuilder + * @see VnfProfileKey + * + */ +@JsonDeserialize(as = VnfProfileImpl.class) +@JsonIgnoreProperties(value = {"localAffinityOrAntiAffinityRule"}, ignoreUnknown = true) +//@JsonIgnoreProperties(value= {"virtualStorageDesc","extCpd","securityGroupRule","indicator","swImageDesc"}, ignoreUnknown = true) +public interface VnfProfile + extends + ChildOf, + Augmentable, + LocalAffinityOrAntiAffinityRule, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnf-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VnfProfile.class; + } + + /** + * Identifier of this vnfProfile information element. It uniquely identifies a + * VnfProfile. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * References a VNFD. + * + * + * + * @return java.lang.String vnfdId, or null if not present + */ + @Nullable String getVnfdId(); + + /** + * Identifies a flavour within the VNFD. + * + * + * + * @return java.lang.String flavourId, or null if not present + */ + @Nullable String getFlavourId(); + + /** + * Identifier of the instantiation level of the VNF DF to be used for + * instantiation. If not present, the default instantiation level as declared in + * the VNFD shall be used. + * + * + * + * @return java.lang.String instantiationLevel, or null if not present + */ + @Nullable String getInstantiationLevel(); + + /** + * Minimum number of instances of the VNF based on this VNFD that is permitted to + * exist for this VnfProfile. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 minNumberOfInstances, or null if not present + */ + @Nullable Uint16 getMinNumberOfInstances(); + + /** + * Maximum number of instances of the VNF based on this VNFD that is permitted to + * exist for this VnfProfile. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 maxNumberOfInstances, or null if not present + */ + @Nullable Uint16 getMaxNumberOfInstances(); + + /** + * Identifier(s) of the affinity or anti-affinity group(s) the VnfProfile belongs + * to. + * + * + * + * @return java.util.Map affinityOrAntiAffinityGroup, or null if not present + */ + @Nullable Map getAffinityOrAntiAffinityGroup(); + + /** + * @return java.util.Map affinityOrAntiAffinityGroup, or an empty list if it is not present + */ + default @NonNull Map nonnullAffinityOrAntiAffinityGroup() { + return CodeHelpers.nonnull(getAffinityOrAntiAffinityGroup()); + } + + /** + * Defines the connection information of the VNF, it contains connection + * relationship between a VNF connection point and a NS Virtual Link. + * + * + * + * @return java.util.Map virtualLinkConnectivity, or null if not present + */ + @Nullable Map getVirtualLinkConnectivity(); + + /** + * @return java.util.Map virtualLinkConnectivity, or an empty list if it is not present + */ + default @NonNull Map nonnullVirtualLinkConnectivity() { + return CodeHelpers.nonnull(getVirtualLinkConnectivity()); + } + + @Override + VnfProfileKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VnfProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VnfProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..f778bc08efd8a83bc972df9b26dbe26aa87a6637 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VnfProfileBuilder.java @@ -0,0 +1,545 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Integer; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule.LocalAffinityOrAntiAffinityRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule.LocalAffinityOrAntiAffinityRuleKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nfv.NsdBuilder; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.VirtualLinkConnectivity; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.VirtualLinkConnectivityKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Class that builds {@link VnfProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfProfileBuilder + * @see Builder + * + */ +public class VnfProfileBuilder implements Builder { + + private Map _affinityOrAntiAffinityGroup; + private String _flavourId; + private String _id; + private String _instantiationLevel; + private Map _localAffinityOrAntiAffinityRule; + private Uint16 _maxNumberOfInstances; + private Uint16 _minNumberOfInstances; + private Map _virtualLinkConnectivity; + private String _vnfdId; + private VnfProfileKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfProfileBuilder() { + } + public VnfProfileBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule arg) { + this._localAffinityOrAntiAffinityRule = arg.getLocalAffinityOrAntiAffinityRule(); + } + + public VnfProfileBuilder(VnfProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._affinityOrAntiAffinityGroup = base.getAffinityOrAntiAffinityGroup(); + this._flavourId = base.getFlavourId(); + this._instantiationLevel = base.getInstantiationLevel(); + this._localAffinityOrAntiAffinityRule = base.getLocalAffinityOrAntiAffinityRule(); + this._maxNumberOfInstances = base.getMaxNumberOfInstances(); + this._minNumberOfInstances = base.getMinNumberOfInstances(); + this._virtualLinkConnectivity = base.getVirtualLinkConnectivity(); + this._vnfdId = base.getVnfdId(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule) { + this._localAffinityOrAntiAffinityRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule)arg).getLocalAffinityOrAntiAffinityRule(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule]"); + } + + public VnfProfileKey key() { + return key; + } + + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + public String getFlavourId() { + return _flavourId; + } + + public String getId() { + return _id; + } + + public String getInstantiationLevel() { + return _instantiationLevel; + } + + public Map getLocalAffinityOrAntiAffinityRule() { + return _localAffinityOrAntiAffinityRule; + } + + public Uint16 getMaxNumberOfInstances() { + return _maxNumberOfInstances; + } + + public Uint16 getMinNumberOfInstances() { + return _minNumberOfInstances; + } + + public Map getVirtualLinkConnectivity() { + return _virtualLinkConnectivity; + } + + public String getVnfdId() { + return _vnfdId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VnfProfileBuilder withKey(final VnfProfileKey key) { + this.key = key; + return this; + } + public VnfProfileBuilder setAffinityOrAntiAffinityGroup(final Map values) { + this._affinityOrAntiAffinityGroup = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setAffinityOrAntiAffinityGroup(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfProfileBuilder setAffinityOrAntiAffinityGroup(final List values) { + return setAffinityOrAntiAffinityGroup(CodeHelpers.compatMap(values)); + } + + public VnfProfileBuilder setFlavourId(final String value) { + this._flavourId = value; + return this; + } + + public VnfProfileBuilder setId(final String value) { + this._id = value; + return this; + } + + public VnfProfileBuilder setInstantiationLevel(final String value) { + this._instantiationLevel = value; + return this; + } + public VnfProfileBuilder setLocalAffinityOrAntiAffinityRule(final Map values) { + this._localAffinityOrAntiAffinityRule = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setLocalAffinityOrAntiAffinityRule(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfProfileBuilder setLocalAffinityOrAntiAffinityRule(final List values) { + return setLocalAffinityOrAntiAffinityRule(CodeHelpers.compatMap(values)); + } + + public VnfProfileBuilder setMaxNumberOfInstances(final Uint16 value) { + this._maxNumberOfInstances = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setMaxNumberOfInstances(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public VnfProfileBuilder setMaxNumberOfInstances(final Integer value) { + return setMaxNumberOfInstances(CodeHelpers.compatUint(value)); + } + + public VnfProfileBuilder setMinNumberOfInstances(final Uint16 value) { + this._minNumberOfInstances = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setMinNumberOfInstances(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public VnfProfileBuilder setMinNumberOfInstances(final Integer value) { + return setMinNumberOfInstances(CodeHelpers.compatUint(value)); + } + public VnfProfileBuilder setVirtualLinkConnectivity(final Map values) { + this._virtualLinkConnectivity = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualLinkConnectivity(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfProfileBuilder setVirtualLinkConnectivity(final List values) { + return setVirtualLinkConnectivity(CodeHelpers.compatMap(values)); + } + + public VnfProfileBuilder setVnfdId(final String value) { + this._vnfdId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VnfProfile build() { + return new VnfProfileImpl(this); + } + + public static final class VnfProfileImpl + extends AbstractAugmentable + implements VnfProfile { + + private final Map _affinityOrAntiAffinityGroup; + private final String _flavourId; + @JsonProperty("id") + private final String _id; + private final String _instantiationLevel; + private final Map _localAffinityOrAntiAffinityRule; + private final Uint16 _maxNumberOfInstances; + private final Uint16 _minNumberOfInstances; + private final Map _virtualLinkConnectivity; + @JsonProperty("vnfd-id") + private final String _vnfdId; + private VnfProfileKey key; + + VnfProfileImpl(VnfProfileBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VnfProfileKey(base.getId()); + } + this._id = key.getId(); + this._affinityOrAntiAffinityGroup = CodeHelpers.emptyToNull(base.getAffinityOrAntiAffinityGroup()); + this._flavourId = base.getFlavourId(); + this._instantiationLevel = base.getInstantiationLevel(); + this._localAffinityOrAntiAffinityRule = CodeHelpers.emptyToNull(base.getLocalAffinityOrAntiAffinityRule()); + this._maxNumberOfInstances = base.getMaxNumberOfInstances(); + this._minNumberOfInstances = base.getMinNumberOfInstances(); + this._virtualLinkConnectivity = CodeHelpers.emptyToNull(base.getVirtualLinkConnectivity()); + this._vnfdId = base.getVnfdId(); + } + + public VnfProfileImpl(){ + this( new VnfProfileBuilder() ); + } + + @Override + public VnfProfileKey key() { + return key; + } + + @Override + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + @Override + public String getFlavourId() { + return _flavourId; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getInstantiationLevel() { + return _instantiationLevel; + } + + @Override + public Map getLocalAffinityOrAntiAffinityRule() { + return _localAffinityOrAntiAffinityRule; + } + + @Override + public Uint16 getMaxNumberOfInstances() { + return _maxNumberOfInstances; + } + + @Override + public Uint16 getMinNumberOfInstances() { + return _minNumberOfInstances; + } + + @Override + public Map getVirtualLinkConnectivity() { + return _virtualLinkConnectivity; + } + + @Override + public String getVnfdId() { + return _vnfdId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_affinityOrAntiAffinityGroup); + result = prime * result + Objects.hashCode(_flavourId); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_instantiationLevel); + result = prime * result + Objects.hashCode(_localAffinityOrAntiAffinityRule); + result = prime * result + Objects.hashCode(_maxNumberOfInstances); + result = prime * result + Objects.hashCode(_minNumberOfInstances); + result = prime * result + Objects.hashCode(_virtualLinkConnectivity); + result = prime * result + Objects.hashCode(_vnfdId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VnfProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VnfProfile other = (VnfProfile)obj; + if (!Objects.equals(_affinityOrAntiAffinityGroup, other.getAffinityOrAntiAffinityGroup())) { + return false; + } + if (!Objects.equals(_flavourId, other.getFlavourId())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_instantiationLevel, other.getInstantiationLevel())) { + return false; + } + if (!Objects.equals(_localAffinityOrAntiAffinityRule, other.getLocalAffinityOrAntiAffinityRule())) { + return false; + } + if (!Objects.equals(_maxNumberOfInstances, other.getMaxNumberOfInstances())) { + return false; + } + if (!Objects.equals(_minNumberOfInstances, other.getMinNumberOfInstances())) { + return false; + } + if (!Objects.equals(_virtualLinkConnectivity, other.getVirtualLinkConnectivity())) { + return false; + } + if (!Objects.equals(_vnfdId, other.getVnfdId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfProfileImpl otherImpl = (VnfProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VnfProfile"); + CodeHelpers.appendValue(helper, "_affinityOrAntiAffinityGroup", _affinityOrAntiAffinityGroup); + CodeHelpers.appendValue(helper, "_flavourId", _flavourId); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_instantiationLevel", _instantiationLevel); + CodeHelpers.appendValue(helper, "_localAffinityOrAntiAffinityRule", _localAffinityOrAntiAffinityRule); + CodeHelpers.appendValue(helper, "_maxNumberOfInstances", _maxNumberOfInstances); + CodeHelpers.appendValue(helper, "_minNumberOfInstances", _minNumberOfInstances); + CodeHelpers.appendValue(helper, "_virtualLinkConnectivity", _virtualLinkConnectivity); + CodeHelpers.appendValue(helper, "_vnfdId", _vnfdId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VnfProfileKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VnfProfileKey.java new file mode 100644 index 0000000000000000000000000000000000000000..52388b18d606d71b6248ddd642b8a49fbb67f319 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/VnfProfileKey.java @@ -0,0 +1,76 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.KeyDeserializer; +import com.google.common.base.MoreObjects; + +import java.io.IOException; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VnfProfileKey extends KeyDeserializer + implements Identifier { + private static final long serialVersionUID = -691004659524246111L; + private final String _id; + + public VnfProfileKey() { + // This might be also null, or not id/flavor not final. + this._id = ""; + } + + public VnfProfileKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VnfProfileKey(VnfProfileKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VnfProfileKey)) { + return false; + } + final VnfProfileKey other = (VnfProfileKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VnfProfileKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } + + @Override + public Object deserializeKey(String key, DeserializationContext ctxt) throws IOException { + // TODO Auto-generated method stub + return this.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/PrimaryId.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/PrimaryId.java new file mode 100644 index 0000000000000000000000000000000000000000..7543985770ff10f0334ab8ce2f51b11395c9444c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/PrimaryId.java @@ -0,0 +1,45 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.Dependencies; +import org.opendaylight.yangtools.yang.binding.ChoiceIn; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * References a VnfProfile or NsProfile. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * choice primary-id {
+ *   case primary-vnf-profile {
+ *     leaf primary-vnf-profile {
+ *       type leafref {
+ *         path ../../vnf-profile/vnfd-id;
+ *       }
+ *     }
+ *   }
+ *   case primary-ns-profile {
+ *     leaf primary-ns-profile {
+ *       type leafref {
+ *         path ../../ns-profile/nsd-id;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/dependencies/primary-id + * + */ +public interface PrimaryId + extends + ChoiceIn +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("primary-id"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/SecondaryId.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/SecondaryId.java new file mode 100644 index 0000000000000000000000000000000000000000..b702fde2791b4b3b37831fee8bc0f0bd8be07511 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/SecondaryId.java @@ -0,0 +1,45 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.Dependencies; +import org.opendaylight.yangtools.yang.binding.ChoiceIn; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * References a VnfProfile or NsProfile. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * choice secondary-id {
+ *   case secondary-vnf-profile {
+ *     leaf secondary-vnf-profile {
+ *       type leafref {
+ *         path ../../vnf-profile/vnfd-id;
+ *       }
+ *     }
+ *   }
+ *   case secondary-ns-profile {
+ *     leaf secondary-ns-profile {
+ *       type leafref {
+ *         path ../../ns-profile/nsd-id;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/dependencies/secondary-id + * + */ +public interface SecondaryId + extends + ChoiceIn +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("secondary-id"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryNsProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryNsProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..fbf11c092edad561d91363f117ad189e8f4d2188 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryNsProfile.java @@ -0,0 +1,35 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.primary.id; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.PrimaryId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface PrimaryNsProfile + extends + DataObject, + Augmentable, + PrimaryId +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("primary-ns-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.primary.id.PrimaryNsProfile.class; + } + + /** + * @return java.lang.String primaryNsProfile, or null if not present + */ + @Nullable String getPrimaryNsProfile(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryNsProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryNsProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..8fee129251ea87746990c787815d3e398f53c189 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryNsProfileBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.primary.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PrimaryNsProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PrimaryNsProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PrimaryNsProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PrimaryNsProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PrimaryNsProfileBuilder + * @see Builder + * + */ +public class PrimaryNsProfileBuilder implements Builder { + + private String _primaryNsProfile; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PrimaryNsProfileBuilder() { + } + + public PrimaryNsProfileBuilder(PrimaryNsProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._primaryNsProfile = base.getPrimaryNsProfile(); + } + + + public String getPrimaryNsProfile() { + return _primaryNsProfile; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public PrimaryNsProfileBuilder setPrimaryNsProfile(final String value) { + this._primaryNsProfile = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PrimaryNsProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PrimaryNsProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PrimaryNsProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PrimaryNsProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public PrimaryNsProfile build() { + return new PrimaryNsProfileImpl(this); + } + + private static final class PrimaryNsProfileImpl + extends AbstractAugmentable + implements PrimaryNsProfile { + + private final String _primaryNsProfile; + + PrimaryNsProfileImpl(PrimaryNsProfileBuilder base) { + super(base.augmentation); + this._primaryNsProfile = base.getPrimaryNsProfile(); + } + + @Override + public String getPrimaryNsProfile() { + return _primaryNsProfile; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_primaryNsProfile); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!PrimaryNsProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + PrimaryNsProfile other = (PrimaryNsProfile)obj; + if (!Objects.equals(_primaryNsProfile, other.getPrimaryNsProfile())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PrimaryNsProfileImpl otherImpl = (PrimaryNsProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("PrimaryNsProfile"); + CodeHelpers.appendValue(helper, "_primaryNsProfile", _primaryNsProfile); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryVnfProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryVnfProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..41ade67d49d68a0d5fd339cd10bb242892245a94 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryVnfProfile.java @@ -0,0 +1,35 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.primary.id; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.PrimaryId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface PrimaryVnfProfile + extends + DataObject, + Augmentable, + PrimaryId +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("primary-vnf-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.primary.id.PrimaryVnfProfile.class; + } + + /** + * @return java.lang.String primaryVnfProfile, or null if not present + */ + @Nullable String getPrimaryVnfProfile(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryVnfProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryVnfProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..daad791c21bcd431cff58b54c2d65f51c84cc819 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/primary/id/PrimaryVnfProfileBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.primary.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PrimaryVnfProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PrimaryVnfProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PrimaryVnfProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PrimaryVnfProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PrimaryVnfProfileBuilder + * @see Builder + * + */ +public class PrimaryVnfProfileBuilder implements Builder { + + private String _primaryVnfProfile; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PrimaryVnfProfileBuilder() { + } + + public PrimaryVnfProfileBuilder(PrimaryVnfProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._primaryVnfProfile = base.getPrimaryVnfProfile(); + } + + + public String getPrimaryVnfProfile() { + return _primaryVnfProfile; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public PrimaryVnfProfileBuilder setPrimaryVnfProfile(final String value) { + this._primaryVnfProfile = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PrimaryVnfProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PrimaryVnfProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PrimaryVnfProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PrimaryVnfProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public PrimaryVnfProfile build() { + return new PrimaryVnfProfileImpl(this); + } + + private static final class PrimaryVnfProfileImpl + extends AbstractAugmentable + implements PrimaryVnfProfile { + + private final String _primaryVnfProfile; + + PrimaryVnfProfileImpl(PrimaryVnfProfileBuilder base) { + super(base.augmentation); + this._primaryVnfProfile = base.getPrimaryVnfProfile(); + } + + @Override + public String getPrimaryVnfProfile() { + return _primaryVnfProfile; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_primaryVnfProfile); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!PrimaryVnfProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + PrimaryVnfProfile other = (PrimaryVnfProfile)obj; + if (!Objects.equals(_primaryVnfProfile, other.getPrimaryVnfProfile())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PrimaryVnfProfileImpl otherImpl = (PrimaryVnfProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("PrimaryVnfProfile"); + CodeHelpers.appendValue(helper, "_primaryVnfProfile", _primaryVnfProfile); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryNsProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryNsProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..c81477f810631c76b9c74fb9984d3464ce019838 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryNsProfile.java @@ -0,0 +1,35 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.secondary.id; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.SecondaryId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface SecondaryNsProfile + extends + DataObject, + Augmentable, + SecondaryId +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("secondary-ns-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.secondary.id.SecondaryNsProfile.class; + } + + /** + * @return java.lang.String secondaryNsProfile, or null if not present + */ + @Nullable String getSecondaryNsProfile(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryNsProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryNsProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..a08a7de97ef215a52d13e79792af1363bad95817 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryNsProfileBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.secondary.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link SecondaryNsProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     SecondaryNsProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new SecondaryNsProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of SecondaryNsProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see SecondaryNsProfileBuilder + * @see Builder + * + */ +public class SecondaryNsProfileBuilder implements Builder { + + private String _secondaryNsProfile; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public SecondaryNsProfileBuilder() { + } + + public SecondaryNsProfileBuilder(SecondaryNsProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._secondaryNsProfile = base.getSecondaryNsProfile(); + } + + + public String getSecondaryNsProfile() { + return _secondaryNsProfile; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public SecondaryNsProfileBuilder setSecondaryNsProfile(final String value) { + this._secondaryNsProfile = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public SecondaryNsProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public SecondaryNsProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public SecondaryNsProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private SecondaryNsProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public SecondaryNsProfile build() { + return new SecondaryNsProfileImpl(this); + } + + private static final class SecondaryNsProfileImpl + extends AbstractAugmentable + implements SecondaryNsProfile { + + private final String _secondaryNsProfile; + + SecondaryNsProfileImpl(SecondaryNsProfileBuilder base) { + super(base.augmentation); + this._secondaryNsProfile = base.getSecondaryNsProfile(); + } + + @Override + public String getSecondaryNsProfile() { + return _secondaryNsProfile; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_secondaryNsProfile); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!SecondaryNsProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + SecondaryNsProfile other = (SecondaryNsProfile)obj; + if (!Objects.equals(_secondaryNsProfile, other.getSecondaryNsProfile())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + SecondaryNsProfileImpl otherImpl = (SecondaryNsProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("SecondaryNsProfile"); + CodeHelpers.appendValue(helper, "_secondaryNsProfile", _secondaryNsProfile); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryVnfProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryVnfProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..6742ded4c16058a6d42aabd1ab7f88865732816c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryVnfProfile.java @@ -0,0 +1,35 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.secondary.id; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.SecondaryId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface SecondaryVnfProfile + extends + DataObject, + Augmentable, + SecondaryId +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("secondary-vnf-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.secondary.id.SecondaryVnfProfile.class; + } + + /** + * @return java.lang.String secondaryVnfProfile, or null if not present + */ + @Nullable String getSecondaryVnfProfile(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryVnfProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryVnfProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..7084d29e1e5c556a66764496d067c3a5c69bb2a4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/dependencies/secondary/id/SecondaryVnfProfileBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.dependencies.secondary.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link SecondaryVnfProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     SecondaryVnfProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new SecondaryVnfProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of SecondaryVnfProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see SecondaryVnfProfileBuilder + * @see Builder + * + */ +public class SecondaryVnfProfileBuilder implements Builder { + + private String _secondaryVnfProfile; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public SecondaryVnfProfileBuilder() { + } + + public SecondaryVnfProfileBuilder(SecondaryVnfProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._secondaryVnfProfile = base.getSecondaryVnfProfile(); + } + + + public String getSecondaryVnfProfile() { + return _secondaryVnfProfile; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public SecondaryVnfProfileBuilder setSecondaryVnfProfile(final String value) { + this._secondaryVnfProfile = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public SecondaryVnfProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public SecondaryVnfProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public SecondaryVnfProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private SecondaryVnfProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public SecondaryVnfProfile build() { + return new SecondaryVnfProfileImpl(this); + } + + private static final class SecondaryVnfProfileImpl + extends AbstractAugmentable + implements SecondaryVnfProfile { + + private final String _secondaryVnfProfile; + + SecondaryVnfProfileImpl(SecondaryVnfProfileBuilder base) { + super(base.augmentation); + this._secondaryVnfProfile = base.getSecondaryVnfProfile(); + } + + @Override + public String getSecondaryVnfProfile() { + return _secondaryVnfProfile; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_secondaryVnfProfile); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!SecondaryVnfProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + SecondaryVnfProfile other = (SecondaryVnfProfile)obj; + if (!Objects.equals(_secondaryVnfProfile, other.getSecondaryVnfProfile())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + SecondaryVnfProfileImpl otherImpl = (SecondaryVnfProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("SecondaryVnfProfile"); + CodeHelpers.appendValue(helper, "_secondaryVnfProfile", _secondaryVnfProfile); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/MonitoringParameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/MonitoringParameter.java new file mode 100644 index 0000000000000000000000000000000000000000..919144fb99687ef42a950098bce30839034beae7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/MonitoringParameter.java @@ -0,0 +1,92 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.MonitoredInfo; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container monitoring-parameter {
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf performance-metric {
+ *     type string;
+ *   }
+ *   leaf collection-period {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/monitored-info/monitoring-parameter + * + *

To create instances of this class use {@link MonitoringParameterBuilder}. + * @see MonitoringParameterBuilder + * + */ +public interface MonitoringParameter + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("monitoring-parameter"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info.MonitoringParameter.class; + } + + /** + * Unique identifier of this monitoring parameter information element. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Human readable name of the monitoring parameter. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Defines the virtualised resource-related performance metric. + * + * + * + * @return java.lang.String performanceMetric, or null if not present + */ + @Nullable String getPerformanceMetric(); + + /** + * An attribute that describes the periodicity at which to collect the performance + * information. + * + * + * + * @return java.lang.String collectionPeriod, or null if not present + */ + @Nullable String getCollectionPeriod(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/MonitoringParameterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/MonitoringParameterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..604f4a4da64d6a4523427a8a9f603954e54b3977 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/MonitoringParameterBuilder.java @@ -0,0 +1,296 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link MonitoringParameterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     MonitoringParameterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new MonitoringParameterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of MonitoringParameterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see MonitoringParameterBuilder + * @see Builder + * + */ +public class MonitoringParameterBuilder implements Builder { + + private String _collectionPeriod; + private String _id; + private String _name; + private String _performanceMetric; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public MonitoringParameterBuilder() { + } + + public MonitoringParameterBuilder(MonitoringParameter base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._collectionPeriod = base.getCollectionPeriod(); + this._id = base.getId(); + this._name = base.getName(); + this._performanceMetric = base.getPerformanceMetric(); + } + + + public String getCollectionPeriod() { + return _collectionPeriod; + } + + public String getId() { + return _id; + } + + public String getName() { + return _name; + } + + public String getPerformanceMetric() { + return _performanceMetric; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public MonitoringParameterBuilder setCollectionPeriod(final String value) { + this._collectionPeriod = value; + return this; + } + + public MonitoringParameterBuilder setId(final String value) { + this._id = value; + return this; + } + + public MonitoringParameterBuilder setName(final String value) { + this._name = value; + return this; + } + + public MonitoringParameterBuilder setPerformanceMetric(final String value) { + this._performanceMetric = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public MonitoringParameterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public MonitoringParameterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public MonitoringParameterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private MonitoringParameterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public MonitoringParameter build() { + return new MonitoringParameterImpl(this); + } + + private static final class MonitoringParameterImpl + extends AbstractAugmentable + implements MonitoringParameter { + + private final String _collectionPeriod; + private final String _id; + private final String _name; + private final String _performanceMetric; + + MonitoringParameterImpl(MonitoringParameterBuilder base) { + super(base.augmentation); + this._collectionPeriod = base.getCollectionPeriod(); + this._id = base.getId(); + this._name = base.getName(); + this._performanceMetric = base.getPerformanceMetric(); + } + + @Override + public String getCollectionPeriod() { + return _collectionPeriod; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getName() { + return _name; + } + + @Override + public String getPerformanceMetric() { + return _performanceMetric; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_collectionPeriod); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_performanceMetric); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!MonitoringParameter.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + MonitoringParameter other = (MonitoringParameter)obj; + if (!Objects.equals(_collectionPeriod, other.getCollectionPeriod())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_performanceMetric, other.getPerformanceMetric())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + MonitoringParameterImpl otherImpl = (MonitoringParameterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("MonitoringParameter"); + CodeHelpers.appendValue(helper, "_collectionPeriod", _collectionPeriod); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_performanceMetric", _performanceMetric); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/VnfIndicatorInfo.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/VnfIndicatorInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..df5855fa7352208824d796b15d1bbb9fb235e3a5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/VnfIndicatorInfo.java @@ -0,0 +1,72 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.MonitoredInfo; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Uniquely identifies this VNF Indicator information element. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container vnf-indicator-info {
+ *   leaf vnfd-id {
+ *     type leafref {
+ *       path ../../../../../vnfd/id;
+ *     }
+ *   }
+ *   leaf vnf-indicator {
+ *     type leafref {
+ *       path deref(../vnfd-id)/../indicator/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/monitored-info/vnf-indicator-info + * + *

To create instances of this class use {@link VnfIndicatorInfoBuilder}. + * @see VnfIndicatorInfoBuilder + * + */ +public interface VnfIndicatorInfo + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnf-indicator-info"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info.VnfIndicatorInfo.class; + } + + /** + * Identifies a VNFD. + * + * + * + * @return java.lang.String vnfdId, or null if not present + */ + @Nullable String getVnfdId(); + + /** + * Identifies a VNF indicator within the VNFD. + * + * + * + * @return java.lang.String vnfIndicator, or null if not present + */ + @Nullable String getVnfIndicator(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/VnfIndicatorInfoBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/VnfIndicatorInfoBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..a9ad45bd9992e6ebde758ef6b827924e7c01083d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/monitored/info/VnfIndicatorInfoBuilder.java @@ -0,0 +1,250 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.monitored.info; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VnfIndicatorInfoBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfIndicatorInfoBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfIndicatorInfoBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfIndicatorInfoBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfIndicatorInfoBuilder + * @see Builder + * + */ +public class VnfIndicatorInfoBuilder implements Builder { + + private String _vnfIndicator; + private String _vnfdId; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfIndicatorInfoBuilder() { + } + + public VnfIndicatorInfoBuilder(VnfIndicatorInfo base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._vnfIndicator = base.getVnfIndicator(); + this._vnfdId = base.getVnfdId(); + } + + + public String getVnfIndicator() { + return _vnfIndicator; + } + + public String getVnfdId() { + return _vnfdId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VnfIndicatorInfoBuilder setVnfIndicator(final String value) { + this._vnfIndicator = value; + return this; + } + + public VnfIndicatorInfoBuilder setVnfdId(final String value) { + this._vnfdId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfIndicatorInfoBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfIndicatorInfoBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfIndicatorInfoBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfIndicatorInfoBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VnfIndicatorInfo build() { + return new VnfIndicatorInfoImpl(this); + } + + private static final class VnfIndicatorInfoImpl + extends AbstractAugmentable + implements VnfIndicatorInfo { + + private final String _vnfIndicator; + private final String _vnfdId; + + VnfIndicatorInfoImpl(VnfIndicatorInfoBuilder base) { + super(base.augmentation); + this._vnfIndicator = base.getVnfIndicator(); + this._vnfdId = base.getVnfdId(); + } + + @Override + public String getVnfIndicator() { + return _vnfIndicator; + } + + @Override + public String getVnfdId() { + return _vnfdId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_vnfIndicator); + result = prime * result + Objects.hashCode(_vnfdId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VnfIndicatorInfo.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VnfIndicatorInfo other = (VnfIndicatorInfo)obj; + if (!Objects.equals(_vnfIndicator, other.getVnfIndicator())) { + return false; + } + if (!Objects.equals(_vnfdId, other.getVnfdId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfIndicatorInfoImpl otherImpl = (VnfIndicatorInfoImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VnfIndicatorInfo"); + CodeHelpers.appendValue(helper, "_vnfIndicator", _vnfIndicator); + CodeHelpers.appendValue(helper, "_vnfdId", _vnfdId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/NsToLevelMapping.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/NsToLevelMapping.java new file mode 100644 index 0000000000000000000000000000000000000000..54d5b179e77a2001a58e27054da7f49d25a5de02 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/NsToLevelMapping.java @@ -0,0 +1,80 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsInstantiationLevel; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Specifies the profile of the nested NSs involved in this NS level and, for each + * of them, the required number of instances. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list ns-to-level-mapping {
+ *   key ns-profile-id;
+ *   leaf ns-profile-id {
+ *     type leafref {
+ *       path ../../../ns-profile/id;
+ *     }
+ *   }
+ *   leaf number-of-instances {
+ *     default 1;
+ *     type uint32;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/ns-instantiation-level/ns-to-level-mapping + * + *

To create instances of this class use {@link NsToLevelMappingBuilder}. + * @see NsToLevelMappingBuilder + * @see NsToLevelMappingKey + * + */ +public interface NsToLevelMapping + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ns-to-level-mapping"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.NsToLevelMapping.class; + } + + /** + * Identifies the profile to be used for a nested NS involved in the NS level. + * + * + * + * @return java.lang.String nsProfileId, or null if not present + */ + @Nullable String getNsProfileId(); + + /** + * Specifies the number of nested NS instances required for the NS scale level. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 numberOfInstances, or null if not present + */ + @Nullable Uint32 getNumberOfInstances(); + + @Override + NsToLevelMappingKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/NsToLevelMappingBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/NsToLevelMappingBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..91e228f0748e5f9aecab2d2f46af3e57717a4c62 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/NsToLevelMappingBuilder.java @@ -0,0 +1,285 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link NsToLevelMappingBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsToLevelMappingBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsToLevelMappingBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsToLevelMappingBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsToLevelMappingBuilder + * @see Builder + * + */ +public class NsToLevelMappingBuilder implements Builder { + + private String _nsProfileId; + private Uint32 _numberOfInstances; + private NsToLevelMappingKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsToLevelMappingBuilder() { + } + + public NsToLevelMappingBuilder(NsToLevelMapping base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._nsProfileId = base.getNsProfileId(); + this._numberOfInstances = base.getNumberOfInstances(); + } + + + public NsToLevelMappingKey key() { + return key; + } + + public String getNsProfileId() { + return _nsProfileId; + } + + public Uint32 getNumberOfInstances() { + return _numberOfInstances; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public NsToLevelMappingBuilder withKey(final NsToLevelMappingKey key) { + this.key = key; + return this; + } + + public NsToLevelMappingBuilder setNsProfileId(final String value) { + this._nsProfileId = value; + return this; + } + + public NsToLevelMappingBuilder setNumberOfInstances(final Uint32 value) { + this._numberOfInstances = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setNumberOfInstances(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public NsToLevelMappingBuilder setNumberOfInstances(final Long value) { + return setNumberOfInstances(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsToLevelMappingBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsToLevelMappingBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsToLevelMappingBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsToLevelMappingBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public NsToLevelMapping build() { + return new NsToLevelMappingImpl(this); + } + + private static final class NsToLevelMappingImpl + extends AbstractAugmentable + implements NsToLevelMapping { + + private final String _nsProfileId; + private final Uint32 _numberOfInstances; + private final NsToLevelMappingKey key; + + NsToLevelMappingImpl(NsToLevelMappingBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new NsToLevelMappingKey(base.getNsProfileId()); + } + this._nsProfileId = key.getNsProfileId(); + this._numberOfInstances = base.getNumberOfInstances(); + } + + @Override + public NsToLevelMappingKey key() { + return key; + } + + @Override + public String getNsProfileId() { + return _nsProfileId; + } + + @Override + public Uint32 getNumberOfInstances() { + return _numberOfInstances; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_nsProfileId); + result = prime * result + Objects.hashCode(_numberOfInstances); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!NsToLevelMapping.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + NsToLevelMapping other = (NsToLevelMapping)obj; + if (!Objects.equals(_nsProfileId, other.getNsProfileId())) { + return false; + } + if (!Objects.equals(_numberOfInstances, other.getNumberOfInstances())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsToLevelMappingImpl otherImpl = (NsToLevelMappingImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("NsToLevelMapping"); + CodeHelpers.appendValue(helper, "_nsProfileId", _nsProfileId); + CodeHelpers.appendValue(helper, "_numberOfInstances", _numberOfInstances); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/NsToLevelMappingKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/NsToLevelMappingKey.java new file mode 100644 index 0000000000000000000000000000000000000000..a91d807ebd30394774b588a4cd7c535a84407969 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/NsToLevelMappingKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class NsToLevelMappingKey + implements Identifier { + private static final long serialVersionUID = -4492263105637618798L; + private final String _nsProfileId; + + + public NsToLevelMappingKey(String _nsProfileId) { + + this._nsProfileId = _nsProfileId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public NsToLevelMappingKey(NsToLevelMappingKey source) { + this._nsProfileId = source._nsProfileId; + } + + + public String getNsProfileId() { + return _nsProfileId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_nsProfileId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof NsToLevelMappingKey)) { + return false; + } + final NsToLevelMappingKey other = (NsToLevelMappingKey) obj; + if (!Objects.equals(_nsProfileId, other._nsProfileId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(NsToLevelMappingKey.class); + CodeHelpers.appendValue(helper, "_nsProfileId", _nsProfileId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VirtualLinkToLevelMapping.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VirtualLinkToLevelMapping.java new file mode 100644 index 0000000000000000000000000000000000000000..e3a84b4d113a83fe6b147a816592662aed3196ee --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VirtualLinkToLevelMapping.java @@ -0,0 +1,69 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsInstantiationLevel; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies the profile of the VLs involved in this NS level and, for each of + * them, the needed bandwidth. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list virtual-link-to-level-mapping {
+ *   key virtual-link-profile-id;
+ *   leaf virtual-link-profile-id {
+ *     type leafref {
+ *       path ../../../virtual-link-profile/id;
+ *     }
+ *   }
+ *   uses link-bitrate-requirements;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/ns-instantiation-level/virtual-link-to-level-mapping + * + *

To create instances of this class use {@link VirtualLinkToLevelMappingBuilder}. + * @see VirtualLinkToLevelMappingBuilder + * @see VirtualLinkToLevelMappingKey + * + */ +public interface VirtualLinkToLevelMapping + extends + ChildOf, + Augmentable, + LinkBitrateRequirements, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-link-to-level-mapping"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.VirtualLinkToLevelMapping.class; + } + + /** + * Identifies the profile to be used for a VL involved in an NS level. + * + * + * + * @return java.lang.String virtualLinkProfileId, or null if not present + */ + @Nullable String getVirtualLinkProfileId(); + + @Override + VirtualLinkToLevelMappingKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VirtualLinkToLevelMappingBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VirtualLinkToLevelMappingBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..41530f91fe8960a351b084b7050412c279cd7626 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VirtualLinkToLevelMappingBuilder.java @@ -0,0 +1,342 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link VirtualLinkToLevelMappingBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkToLevelMappingBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkToLevelMappingBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkToLevelMappingBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkToLevelMappingBuilder + * @see Builder + * + */ +public class VirtualLinkToLevelMappingBuilder implements Builder { + + private Uint64 _leaf; + private Uint64 _root; + private String _virtualLinkProfileId; + private VirtualLinkToLevelMappingKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualLinkToLevelMappingBuilder() { + } + public VirtualLinkToLevelMappingBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements arg) { + this._root = arg.getRoot(); + this._leaf = arg.getLeaf(); + } + + public VirtualLinkToLevelMappingBuilder(VirtualLinkToLevelMapping base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._virtualLinkProfileId = base.getVirtualLinkProfileId(); + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements) { + this._root = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements)arg).getRoot(); + this._leaf = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements)arg).getLeaf(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements]"); + } + + public VirtualLinkToLevelMappingKey key() { + return key; + } + + public Uint64 getLeaf() { + return _leaf; + } + + public Uint64 getRoot() { + return _root; + } + + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VirtualLinkToLevelMappingBuilder withKey(final VirtualLinkToLevelMappingKey key) { + this.key = key; + return this; + } + + public VirtualLinkToLevelMappingBuilder setLeaf(final Uint64 value) { + this._leaf = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLeaf(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkToLevelMappingBuilder setLeaf(final BigInteger value) { + return setLeaf(CodeHelpers.compatUint(value)); + } + + public VirtualLinkToLevelMappingBuilder setRoot(final Uint64 value) { + this._root = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setRoot(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkToLevelMappingBuilder setRoot(final BigInteger value) { + return setRoot(CodeHelpers.compatUint(value)); + } + + public VirtualLinkToLevelMappingBuilder setVirtualLinkProfileId(final String value) { + this._virtualLinkProfileId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualLinkToLevelMappingBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkToLevelMappingBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualLinkToLevelMappingBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualLinkToLevelMappingBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualLinkToLevelMapping build() { + return new VirtualLinkToLevelMappingImpl(this); + } + + private static final class VirtualLinkToLevelMappingImpl + extends AbstractAugmentable + implements VirtualLinkToLevelMapping { + + private final Uint64 _leaf; + private final Uint64 _root; + private final String _virtualLinkProfileId; + private final VirtualLinkToLevelMappingKey key; + + VirtualLinkToLevelMappingImpl(VirtualLinkToLevelMappingBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VirtualLinkToLevelMappingKey(base.getVirtualLinkProfileId()); + } + this._virtualLinkProfileId = key.getVirtualLinkProfileId(); + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + @Override + public VirtualLinkToLevelMappingKey key() { + return key; + } + + @Override + public Uint64 getLeaf() { + return _leaf; + } + + @Override + public Uint64 getRoot() { + return _root; + } + + @Override + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_leaf); + result = prime * result + Objects.hashCode(_root); + result = prime * result + Objects.hashCode(_virtualLinkProfileId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkToLevelMapping.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkToLevelMapping other = (VirtualLinkToLevelMapping)obj; + if (!Objects.equals(_leaf, other.getLeaf())) { + return false; + } + if (!Objects.equals(_root, other.getRoot())) { + return false; + } + if (!Objects.equals(_virtualLinkProfileId, other.getVirtualLinkProfileId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualLinkToLevelMappingImpl otherImpl = (VirtualLinkToLevelMappingImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkToLevelMapping"); + CodeHelpers.appendValue(helper, "_leaf", _leaf); + CodeHelpers.appendValue(helper, "_root", _root); + CodeHelpers.appendValue(helper, "_virtualLinkProfileId", _virtualLinkProfileId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VirtualLinkToLevelMappingKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VirtualLinkToLevelMappingKey.java new file mode 100644 index 0000000000000000000000000000000000000000..87eb0f989aa956c339f44b7b9b4e32cee037f0f0 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VirtualLinkToLevelMappingKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VirtualLinkToLevelMappingKey + implements Identifier { + private static final long serialVersionUID = 4146079255761774930L; + private final String _virtualLinkProfileId; + + + public VirtualLinkToLevelMappingKey(String _virtualLinkProfileId) { + + this._virtualLinkProfileId = _virtualLinkProfileId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VirtualLinkToLevelMappingKey(VirtualLinkToLevelMappingKey source) { + this._virtualLinkProfileId = source._virtualLinkProfileId; + } + + + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_virtualLinkProfileId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VirtualLinkToLevelMappingKey)) { + return false; + } + final VirtualLinkToLevelMappingKey other = (VirtualLinkToLevelMappingKey) obj; + if (!Objects.equals(_virtualLinkProfileId, other._virtualLinkProfileId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VirtualLinkToLevelMappingKey.class); + CodeHelpers.appendValue(helper, "_virtualLinkProfileId", _virtualLinkProfileId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VnfToLevelMapping.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VnfToLevelMapping.java new file mode 100644 index 0000000000000000000000000000000000000000..0c6d02835e4cdead9f3e77a55cecfb228b499a3d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VnfToLevelMapping.java @@ -0,0 +1,80 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsInstantiationLevel; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Specifies the profile of the VNFs involved in this NS level and, for each of + * them, the required number of instances. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list vnf-to-level-mapping {
+ *   key vnf-profile-id;
+ *   leaf vnf-profile-id {
+ *     type leafref {
+ *       path ../../../vnf-profile/id;
+ *     }
+ *   }
+ *   leaf number-of-instances {
+ *     default 1;
+ *     type uint32;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/ns-instantiation-level/vnf-to-level-mapping + * + *

To create instances of this class use {@link VnfToLevelMappingBuilder}. + * @see VnfToLevelMappingBuilder + * @see VnfToLevelMappingKey + * + */ +public interface VnfToLevelMapping + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnf-to-level-mapping"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level.VnfToLevelMapping.class; + } + + /** + * Identifies the profile to be used for a VNF involved in an NS level. + * + * + * + * @return java.lang.String vnfProfileId, or null if not present + */ + @Nullable String getVnfProfileId(); + + /** + * Specifies the number of VNF instances required for an NS level. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 numberOfInstances, or null if not present + */ + @Nullable Uint32 getNumberOfInstances(); + + @Override + VnfToLevelMappingKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VnfToLevelMappingBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VnfToLevelMappingBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..ad6c01b9cb2aa05b7785314aa302e938de854830 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VnfToLevelMappingBuilder.java @@ -0,0 +1,285 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link VnfToLevelMappingBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfToLevelMappingBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfToLevelMappingBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfToLevelMappingBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfToLevelMappingBuilder + * @see Builder + * + */ +public class VnfToLevelMappingBuilder implements Builder { + + private Uint32 _numberOfInstances; + private String _vnfProfileId; + private VnfToLevelMappingKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfToLevelMappingBuilder() { + } + + public VnfToLevelMappingBuilder(VnfToLevelMapping base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._vnfProfileId = base.getVnfProfileId(); + this._numberOfInstances = base.getNumberOfInstances(); + } + + + public VnfToLevelMappingKey key() { + return key; + } + + public Uint32 getNumberOfInstances() { + return _numberOfInstances; + } + + public String getVnfProfileId() { + return _vnfProfileId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VnfToLevelMappingBuilder withKey(final VnfToLevelMappingKey key) { + this.key = key; + return this; + } + + public VnfToLevelMappingBuilder setNumberOfInstances(final Uint32 value) { + this._numberOfInstances = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setNumberOfInstances(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public VnfToLevelMappingBuilder setNumberOfInstances(final Long value) { + return setNumberOfInstances(CodeHelpers.compatUint(value)); + } + + public VnfToLevelMappingBuilder setVnfProfileId(final String value) { + this._vnfProfileId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfToLevelMappingBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfToLevelMappingBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfToLevelMappingBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfToLevelMappingBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VnfToLevelMapping build() { + return new VnfToLevelMappingImpl(this); + } + + private static final class VnfToLevelMappingImpl + extends AbstractAugmentable + implements VnfToLevelMapping { + + private final Uint32 _numberOfInstances; + private final String _vnfProfileId; + private final VnfToLevelMappingKey key; + + VnfToLevelMappingImpl(VnfToLevelMappingBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VnfToLevelMappingKey(base.getVnfProfileId()); + } + this._vnfProfileId = key.getVnfProfileId(); + this._numberOfInstances = base.getNumberOfInstances(); + } + + @Override + public VnfToLevelMappingKey key() { + return key; + } + + @Override + public Uint32 getNumberOfInstances() { + return _numberOfInstances; + } + + @Override + public String getVnfProfileId() { + return _vnfProfileId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_numberOfInstances); + result = prime * result + Objects.hashCode(_vnfProfileId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VnfToLevelMapping.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VnfToLevelMapping other = (VnfToLevelMapping)obj; + if (!Objects.equals(_numberOfInstances, other.getNumberOfInstances())) { + return false; + } + if (!Objects.equals(_vnfProfileId, other.getVnfProfileId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfToLevelMappingImpl otherImpl = (VnfToLevelMappingImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VnfToLevelMapping"); + CodeHelpers.appendValue(helper, "_numberOfInstances", _numberOfInstances); + CodeHelpers.appendValue(helper, "_vnfProfileId", _vnfProfileId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VnfToLevelMappingKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VnfToLevelMappingKey.java new file mode 100644 index 0000000000000000000000000000000000000000..64cf325f08d9c6d94c657dd14af2fc8824241cf0 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/instantiation/level/VnfToLevelMappingKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.instantiation.level; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VnfToLevelMappingKey + implements Identifier { + private static final long serialVersionUID = -4936475184729003839L; + private final String _vnfProfileId; + + + public VnfToLevelMappingKey(String _vnfProfileId) { + + this._vnfProfileId = _vnfProfileId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VnfToLevelMappingKey(VnfToLevelMappingKey source) { + this._vnfProfileId = source._vnfProfileId; + } + + + public String getVnfProfileId() { + return _vnfProfileId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_vnfProfileId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VnfToLevelMappingKey)) { + return false; + } + final VnfToLevelMappingKey other = (VnfToLevelMappingKey) obj; + if (!Objects.equals(_vnfProfileId, other._vnfProfileId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VnfToLevelMappingKey.class); + CodeHelpers.appendValue(helper, "_vnfProfileId", _vnfProfileId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/AffinityOrAntiAffinityGroupId.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/AffinityOrAntiAffinityGroupId.java new file mode 100644 index 0000000000000000000000000000000000000000..b3b1df81e4c63b08c55a53b67c6a402b06a76bc6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/AffinityOrAntiAffinityGroupId.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsProfile; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Identifies an affinity or anti-affinity group the NSs created according to this + * NsProfile belongs to. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list affinity-or-anti-affinity-group-id {
+ *   key id;
+ *   leaf id {
+ *     type leafref {
+ *       path ../../../affinity-or-anti-affinity-group/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/ns-profile/affinity-or-anti-affinity-group-id + * + *

To create instances of this class use {@link AffinityOrAntiAffinityGroupIdBuilder}. + * @see AffinityOrAntiAffinityGroupIdBuilder + * @see AffinityOrAntiAffinityGroupIdKey + * + */ +public interface AffinityOrAntiAffinityGroupId + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("affinity-or-anti-affinity-group-id"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.AffinityOrAntiAffinityGroupId.class; + } + + /** + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + @Override + AffinityOrAntiAffinityGroupIdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/AffinityOrAntiAffinityGroupIdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/AffinityOrAntiAffinityGroupIdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..e3a8b36f26e10f0bc8116fdec79518736616fff3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/AffinityOrAntiAffinityGroupIdBuilder.java @@ -0,0 +1,248 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link AffinityOrAntiAffinityGroupIdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AffinityOrAntiAffinityGroupIdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AffinityOrAntiAffinityGroupIdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AffinityOrAntiAffinityGroupIdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AffinityOrAntiAffinityGroupIdBuilder + * @see Builder + * + */ +public class AffinityOrAntiAffinityGroupIdBuilder implements Builder { + + private String _id; + private AffinityOrAntiAffinityGroupIdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AffinityOrAntiAffinityGroupIdBuilder() { + } + + public AffinityOrAntiAffinityGroupIdBuilder(AffinityOrAntiAffinityGroupId base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + } + + + public AffinityOrAntiAffinityGroupIdKey key() { + return key; + } + + public String getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AffinityOrAntiAffinityGroupIdBuilder withKey(final AffinityOrAntiAffinityGroupIdKey key) { + this.key = key; + return this; + } + + public AffinityOrAntiAffinityGroupIdBuilder setId(final String value) { + this._id = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AffinityOrAntiAffinityGroupIdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AffinityOrAntiAffinityGroupIdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AffinityOrAntiAffinityGroupIdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AffinityOrAntiAffinityGroupIdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public AffinityOrAntiAffinityGroupId build() { + return new AffinityOrAntiAffinityGroupIdImpl(this); + } + + private static final class AffinityOrAntiAffinityGroupIdImpl + extends AbstractAugmentable + implements AffinityOrAntiAffinityGroupId { + + private final String _id; + private final AffinityOrAntiAffinityGroupIdKey key; + + AffinityOrAntiAffinityGroupIdImpl(AffinityOrAntiAffinityGroupIdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new AffinityOrAntiAffinityGroupIdKey(base.getId()); + } + this._id = key.getId(); + } + + @Override + public AffinityOrAntiAffinityGroupIdKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!AffinityOrAntiAffinityGroupId.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + AffinityOrAntiAffinityGroupId other = (AffinityOrAntiAffinityGroupId)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AffinityOrAntiAffinityGroupIdImpl otherImpl = (AffinityOrAntiAffinityGroupIdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("AffinityOrAntiAffinityGroupId"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/AffinityOrAntiAffinityGroupIdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/AffinityOrAntiAffinityGroupIdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..a95fbea922bcd730cb5bb630aa42bba622b8da7b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/AffinityOrAntiAffinityGroupIdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class AffinityOrAntiAffinityGroupIdKey + implements Identifier { + private static final long serialVersionUID = 3909093279935746030L; + private final String _id; + + + public AffinityOrAntiAffinityGroupIdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public AffinityOrAntiAffinityGroupIdKey(AffinityOrAntiAffinityGroupIdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof AffinityOrAntiAffinityGroupIdKey)) { + return false; + } + final AffinityOrAntiAffinityGroupIdKey other = (AffinityOrAntiAffinityGroupIdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(AffinityOrAntiAffinityGroupIdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/VirtualLinkConnectivity.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/VirtualLinkConnectivity.java new file mode 100644 index 0000000000000000000000000000000000000000..644d24f734a9af7cdf8605bf124dda9e876d6afe --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/VirtualLinkConnectivity.java @@ -0,0 +1,99 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.NsProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.virtual.link.connectivity.ConstituentCpdId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.virtual.link.connectivity.ConstituentCpdIdKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list virtual-link-connectivity {
+ *   key virtual-link-profile-id;
+ *   leaf virtual-link-profile-id {
+ *     type leafref {
+ *       path ../../../virtual-link-profile/id;
+ *     }
+ *   }
+ *   list constituent-cpd-id {
+ *     key constituent-base-element-id;
+ *     leaf constituent-base-element-id {
+ *       type leafref {
+ *         path ../../../id;
+ *       }
+ *     }
+ *     leaf constituent-cpd-id {
+ *       type leafref {
+ *         path deref(../../../nsd-id)/../sapd/id;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/ns-profile/virtual-link-connectivity + * + *

To create instances of this class use {@link VirtualLinkConnectivityBuilder}. + * @see VirtualLinkConnectivityBuilder + * @see VirtualLinkConnectivityKey + * + */ +public interface VirtualLinkConnectivity + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-link-connectivity"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.VirtualLinkConnectivity.class; + } + + /** + * Reference an NS VL profile. + * + * + * + * @return java.lang.String virtualLinkProfileId, or null if not present + */ + @Nullable String getVirtualLinkProfileId(); + + /** + * Describes a connection point on a VNF/PNF or a SAP which connects to virtual + * links instantiated from the profile identified in the virtualLinkProfileId + * attribute. + * + * + * + * @return java.util.Map constituentCpdId, or null if not present + */ + @Nullable Map getConstituentCpdId(); + + /** + * @return java.util.Map constituentCpdId, or an empty list if it is not present + */ + default @NonNull Map nonnullConstituentCpdId() { + return CodeHelpers.nonnull(getConstituentCpdId()); + } + + @Override + VirtualLinkConnectivityKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/VirtualLinkConnectivityBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/VirtualLinkConnectivityBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..8d20d2432cafd341f6bf12097ecd3dc580c7b516 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/VirtualLinkConnectivityBuilder.java @@ -0,0 +1,291 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.virtual.link.connectivity.ConstituentCpdId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.virtual.link.connectivity.ConstituentCpdIdKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualLinkConnectivityBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkConnectivityBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkConnectivityBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkConnectivityBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkConnectivityBuilder + * @see Builder + * + */ +public class VirtualLinkConnectivityBuilder implements Builder { + + private Map _constituentCpdId; + private String _virtualLinkProfileId; + private VirtualLinkConnectivityKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualLinkConnectivityBuilder() { + } + + public VirtualLinkConnectivityBuilder(VirtualLinkConnectivity base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._virtualLinkProfileId = base.getVirtualLinkProfileId(); + this._constituentCpdId = base.getConstituentCpdId(); + } + + + public VirtualLinkConnectivityKey key() { + return key; + } + + public Map getConstituentCpdId() { + return _constituentCpdId; + } + + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VirtualLinkConnectivityBuilder withKey(final VirtualLinkConnectivityKey key) { + this.key = key; + return this; + } + public VirtualLinkConnectivityBuilder setConstituentCpdId(final Map values) { + this._constituentCpdId = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setConstituentCpdId(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkConnectivityBuilder setConstituentCpdId(final List values) { + return setConstituentCpdId(CodeHelpers.compatMap(values)); + } + + public VirtualLinkConnectivityBuilder setVirtualLinkProfileId(final String value) { + this._virtualLinkProfileId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualLinkConnectivityBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkConnectivityBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualLinkConnectivityBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualLinkConnectivityBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualLinkConnectivity build() { + return new VirtualLinkConnectivityImpl(this); + } + + private static final class VirtualLinkConnectivityImpl + extends AbstractAugmentable + implements VirtualLinkConnectivity { + + private final Map _constituentCpdId; + private final String _virtualLinkProfileId; + private final VirtualLinkConnectivityKey key; + + VirtualLinkConnectivityImpl(VirtualLinkConnectivityBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VirtualLinkConnectivityKey(base.getVirtualLinkProfileId()); + } + this._virtualLinkProfileId = key.getVirtualLinkProfileId(); + this._constituentCpdId = CodeHelpers.emptyToNull(base.getConstituentCpdId()); + } + + @Override + public VirtualLinkConnectivityKey key() { + return key; + } + + @Override + public Map getConstituentCpdId() { + return _constituentCpdId; + } + + @Override + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_constituentCpdId); + result = prime * result + Objects.hashCode(_virtualLinkProfileId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkConnectivity.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkConnectivity other = (VirtualLinkConnectivity)obj; + if (!Objects.equals(_constituentCpdId, other.getConstituentCpdId())) { + return false; + } + if (!Objects.equals(_virtualLinkProfileId, other.getVirtualLinkProfileId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualLinkConnectivityImpl otherImpl = (VirtualLinkConnectivityImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkConnectivity"); + CodeHelpers.appendValue(helper, "_constituentCpdId", _constituentCpdId); + CodeHelpers.appendValue(helper, "_virtualLinkProfileId", _virtualLinkProfileId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/VirtualLinkConnectivityKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/VirtualLinkConnectivityKey.java new file mode 100644 index 0000000000000000000000000000000000000000..31ef211e029e0b1c23b793369273c64ca428e7d8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/VirtualLinkConnectivityKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VirtualLinkConnectivityKey + implements Identifier { + private static final long serialVersionUID = -1012322664145801683L; + private final String _virtualLinkProfileId; + + + public VirtualLinkConnectivityKey(String _virtualLinkProfileId) { + + this._virtualLinkProfileId = _virtualLinkProfileId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VirtualLinkConnectivityKey(VirtualLinkConnectivityKey source) { + this._virtualLinkProfileId = source._virtualLinkProfileId; + } + + + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_virtualLinkProfileId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VirtualLinkConnectivityKey)) { + return false; + } + final VirtualLinkConnectivityKey other = (VirtualLinkConnectivityKey) obj; + if (!Objects.equals(_virtualLinkProfileId, other._virtualLinkProfileId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VirtualLinkConnectivityKey.class); + CodeHelpers.appendValue(helper, "_virtualLinkProfileId", _virtualLinkProfileId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/virtual/link/connectivity/ConstituentCpdId.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/virtual/link/connectivity/ConstituentCpdId.java new file mode 100644 index 0000000000000000000000000000000000000000..72006934601d81c15a4649731139956bcc6f0705 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/virtual/link/connectivity/ConstituentCpdId.java @@ -0,0 +1,83 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.virtual.link.connectivity; +import java.lang.Class; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.VirtualLinkConnectivity; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes a connection point on a VNF/PNF or a SAP which connects to virtual + * links instantiated from the profile identified in the virtualLinkProfileId + * attribute. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list constituent-cpd-id {
+ *   key constituent-base-element-id;
+ *   leaf constituent-base-element-id {
+ *     type leafref {
+ *       path ../../../id;
+ *     }
+ *   }
+ *   leaf constituent-cpd-id {
+ *     type leafref {
+ *       path deref(../../../nsd-id)/../sapd/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/ns-profile/virtual-link-connectivity/constituent-cpd-id + * + *

To create instances of this class use {@link ConstituentCpdIdBuilder}. + * @see ConstituentCpdIdBuilder + * @see ConstituentCpdIdKey + * + */ +public interface ConstituentCpdId + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("constituent-cpd-id"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.virtual.link.connectivity.ConstituentCpdId.class; + } + + /** + * Reference to the profile of an NS constituent. + * + * + * + * @return java.lang.String constituentBaseElementId, or null if not present + */ + @Nullable String getConstituentBaseElementId(); + + /** + * A reference to the descriptor of a connection point attached to one of the + * constituent VNFs and PNFs or to the descriptor of a NS SAP. + * + * + * + * @return java.lang.Object constituentCpdId, or null if not present + */ + @Nullable Object getConstituentCpdId(); + + @Override + ConstituentCpdIdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/virtual/link/connectivity/ConstituentCpdIdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/virtual/link/connectivity/ConstituentCpdIdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..917b0a1f29aed09d1aa974c9142f1032f8c6eec4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/virtual/link/connectivity/ConstituentCpdIdBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.virtual.link.connectivity; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ConstituentCpdIdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ConstituentCpdIdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ConstituentCpdIdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ConstituentCpdIdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ConstituentCpdIdBuilder + * @see Builder + * + */ +public class ConstituentCpdIdBuilder implements Builder { + + private String _constituentBaseElementId; + private Object _constituentCpdId; + private ConstituentCpdIdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ConstituentCpdIdBuilder() { + } + + public ConstituentCpdIdBuilder(ConstituentCpdId base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._constituentBaseElementId = base.getConstituentBaseElementId(); + this._constituentCpdId = base.getConstituentCpdId(); + } + + + public ConstituentCpdIdKey key() { + return key; + } + + public String getConstituentBaseElementId() { + return _constituentBaseElementId; + } + + public Object getConstituentCpdId() { + return _constituentCpdId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ConstituentCpdIdBuilder withKey(final ConstituentCpdIdKey key) { + this.key = key; + return this; + } + + public ConstituentCpdIdBuilder setConstituentBaseElementId(final String value) { + this._constituentBaseElementId = value; + return this; + } + + public ConstituentCpdIdBuilder setConstituentCpdId(final Object value) { + this._constituentCpdId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ConstituentCpdIdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ConstituentCpdIdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ConstituentCpdIdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ConstituentCpdIdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ConstituentCpdId build() { + return new ConstituentCpdIdImpl(this); + } + + private static final class ConstituentCpdIdImpl + extends AbstractAugmentable + implements ConstituentCpdId { + + private final String _constituentBaseElementId; + private final Object _constituentCpdId; + private final ConstituentCpdIdKey key; + + ConstituentCpdIdImpl(ConstituentCpdIdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ConstituentCpdIdKey(base.getConstituentBaseElementId()); + } + this._constituentBaseElementId = key.getConstituentBaseElementId(); + this._constituentCpdId = base.getConstituentCpdId(); + } + + @Override + public ConstituentCpdIdKey key() { + return key; + } + + @Override + public String getConstituentBaseElementId() { + return _constituentBaseElementId; + } + + @Override + public Object getConstituentCpdId() { + return _constituentCpdId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_constituentBaseElementId); + result = prime * result + Objects.hashCode(_constituentCpdId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ConstituentCpdId.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ConstituentCpdId other = (ConstituentCpdId)obj; + if (!Objects.equals(_constituentBaseElementId, other.getConstituentBaseElementId())) { + return false; + } + if (!Objects.equals(_constituentCpdId, other.getConstituentCpdId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ConstituentCpdIdImpl otherImpl = (ConstituentCpdIdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ConstituentCpdId"); + CodeHelpers.appendValue(helper, "_constituentBaseElementId", _constituentBaseElementId); + CodeHelpers.appendValue(helper, "_constituentCpdId", _constituentCpdId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/virtual/link/connectivity/ConstituentCpdIdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/virtual/link/connectivity/ConstituentCpdIdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..3b19b8a40c3f6d5475faee409f754d8df4e4f11e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/ns/profile/virtual/link/connectivity/ConstituentCpdIdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.ns.profile.virtual.link.connectivity; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ConstituentCpdIdKey + implements Identifier { + private static final long serialVersionUID = -6015428103661446636L; + private final String _constituentBaseElementId; + + + public ConstituentCpdIdKey(String _constituentBaseElementId) { + + this._constituentBaseElementId = _constituentBaseElementId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ConstituentCpdIdKey(ConstituentCpdIdKey source) { + this._constituentBaseElementId = source._constituentBaseElementId; + } + + + public String getConstituentBaseElementId() { + return _constituentBaseElementId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_constituentBaseElementId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ConstituentCpdIdKey)) { + return false; + } + final ConstituentCpdIdKey other = (ConstituentCpdIdKey) obj; + if (!Objects.equals(_constituentBaseElementId, other._constituentBaseElementId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ConstituentCpdIdKey.class); + CodeHelpers.appendValue(helper, "_constituentBaseElementId", _constituentBaseElementId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/VirtualLinkConnectivity.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/VirtualLinkConnectivity.java new file mode 100644 index 0000000000000000000000000000000000000000..61ba61cfccbb21da6d8de660c62d7a61b46855e4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/VirtualLinkConnectivity.java @@ -0,0 +1,101 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.PnfProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.virtual.link.connectivity.ConstituentCpdId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.virtual.link.connectivity.ConstituentCpdIdKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Defines the connection information of the PNF, it contains connection + * relationship between a PNF connection point and a NS Virtual Link. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list virtual-link-connectivity {
+ *   key virtual-link-profile-id;
+ *   leaf virtual-link-profile-id {
+ *     type leafref {
+ *       path ../../../virtual-link-profile/id;
+ *     }
+ *   }
+ *   list constituent-cpd-id {
+ *     key constituent-base-element-id;
+ *     leaf constituent-base-element-id {
+ *       type leafref {
+ *         path ../../../id;
+ *       }
+ *     }
+ *     leaf constituent-cpd-id {
+ *       type leafref {
+ *         path deref(../../../pnfd-id)/../ext-cpd/id;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/pnf-profile/virtual-link-connectivity + * + *

To create instances of this class use {@link VirtualLinkConnectivityBuilder}. + * @see VirtualLinkConnectivityBuilder + * @see VirtualLinkConnectivityKey + * + */ +public interface VirtualLinkConnectivity + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-link-connectivity"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.VirtualLinkConnectivity.class; + } + + /** + * Reference an NS VL profile. + * + * + * + * @return java.lang.String virtualLinkProfileId, or null if not present + */ + @Nullable String getVirtualLinkProfileId(); + + /** + * Describes a connection point on a VNF/PNF or a SAP which connects to virtual + * links instantiated from the profile identified in the virtualLinkProfileId + * attribute. + * + * + * + * @return java.util.Map constituentCpdId, or null if not present + */ + @Nullable Map getConstituentCpdId(); + + /** + * @return java.util.Map constituentCpdId, or an empty list if it is not present + */ + default @NonNull Map nonnullConstituentCpdId() { + return CodeHelpers.nonnull(getConstituentCpdId()); + } + + @Override + VirtualLinkConnectivityKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/VirtualLinkConnectivityBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/VirtualLinkConnectivityBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..fde588517b025307cfcd2181bd9f9d06af4976e3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/VirtualLinkConnectivityBuilder.java @@ -0,0 +1,291 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.virtual.link.connectivity.ConstituentCpdId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.virtual.link.connectivity.ConstituentCpdIdKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualLinkConnectivityBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkConnectivityBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkConnectivityBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkConnectivityBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkConnectivityBuilder + * @see Builder + * + */ +public class VirtualLinkConnectivityBuilder implements Builder { + + private Map _constituentCpdId; + private String _virtualLinkProfileId; + private VirtualLinkConnectivityKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualLinkConnectivityBuilder() { + } + + public VirtualLinkConnectivityBuilder(VirtualLinkConnectivity base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._virtualLinkProfileId = base.getVirtualLinkProfileId(); + this._constituentCpdId = base.getConstituentCpdId(); + } + + + public VirtualLinkConnectivityKey key() { + return key; + } + + public Map getConstituentCpdId() { + return _constituentCpdId; + } + + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VirtualLinkConnectivityBuilder withKey(final VirtualLinkConnectivityKey key) { + this.key = key; + return this; + } + public VirtualLinkConnectivityBuilder setConstituentCpdId(final Map values) { + this._constituentCpdId = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setConstituentCpdId(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkConnectivityBuilder setConstituentCpdId(final List values) { + return setConstituentCpdId(CodeHelpers.compatMap(values)); + } + + public VirtualLinkConnectivityBuilder setVirtualLinkProfileId(final String value) { + this._virtualLinkProfileId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualLinkConnectivityBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkConnectivityBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualLinkConnectivityBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualLinkConnectivityBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualLinkConnectivity build() { + return new VirtualLinkConnectivityImpl(this); + } + + private static final class VirtualLinkConnectivityImpl + extends AbstractAugmentable + implements VirtualLinkConnectivity { + + private final Map _constituentCpdId; + private final String _virtualLinkProfileId; + private final VirtualLinkConnectivityKey key; + + VirtualLinkConnectivityImpl(VirtualLinkConnectivityBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VirtualLinkConnectivityKey(base.getVirtualLinkProfileId()); + } + this._virtualLinkProfileId = key.getVirtualLinkProfileId(); + this._constituentCpdId = CodeHelpers.emptyToNull(base.getConstituentCpdId()); + } + + @Override + public VirtualLinkConnectivityKey key() { + return key; + } + + @Override + public Map getConstituentCpdId() { + return _constituentCpdId; + } + + @Override + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_constituentCpdId); + result = prime * result + Objects.hashCode(_virtualLinkProfileId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkConnectivity.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkConnectivity other = (VirtualLinkConnectivity)obj; + if (!Objects.equals(_constituentCpdId, other.getConstituentCpdId())) { + return false; + } + if (!Objects.equals(_virtualLinkProfileId, other.getVirtualLinkProfileId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualLinkConnectivityImpl otherImpl = (VirtualLinkConnectivityImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkConnectivity"); + CodeHelpers.appendValue(helper, "_constituentCpdId", _constituentCpdId); + CodeHelpers.appendValue(helper, "_virtualLinkProfileId", _virtualLinkProfileId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/VirtualLinkConnectivityKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/VirtualLinkConnectivityKey.java new file mode 100644 index 0000000000000000000000000000000000000000..1d1955914309858e7ab920fe4e4b5025cbf5d494 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/VirtualLinkConnectivityKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VirtualLinkConnectivityKey + implements Identifier { + private static final long serialVersionUID = -1012322664145801683L; + private final String _virtualLinkProfileId; + + + public VirtualLinkConnectivityKey(String _virtualLinkProfileId) { + + this._virtualLinkProfileId = _virtualLinkProfileId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VirtualLinkConnectivityKey(VirtualLinkConnectivityKey source) { + this._virtualLinkProfileId = source._virtualLinkProfileId; + } + + + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_virtualLinkProfileId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VirtualLinkConnectivityKey)) { + return false; + } + final VirtualLinkConnectivityKey other = (VirtualLinkConnectivityKey) obj; + if (!Objects.equals(_virtualLinkProfileId, other._virtualLinkProfileId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VirtualLinkConnectivityKey.class); + CodeHelpers.appendValue(helper, "_virtualLinkProfileId", _virtualLinkProfileId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/virtual/link/connectivity/ConstituentCpdId.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/virtual/link/connectivity/ConstituentCpdId.java new file mode 100644 index 0000000000000000000000000000000000000000..afa88cda3346f75f8d950bf7b2449742d992b758 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/virtual/link/connectivity/ConstituentCpdId.java @@ -0,0 +1,83 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.virtual.link.connectivity; +import java.lang.Class; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.VirtualLinkConnectivity; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes a connection point on a VNF/PNF or a SAP which connects to virtual + * links instantiated from the profile identified in the virtualLinkProfileId + * attribute. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list constituent-cpd-id {
+ *   key constituent-base-element-id;
+ *   leaf constituent-base-element-id {
+ *     type leafref {
+ *       path ../../../id;
+ *     }
+ *   }
+ *   leaf constituent-cpd-id {
+ *     type leafref {
+ *       path deref(../../../pnfd-id)/../ext-cpd/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/pnf-profile/virtual-link-connectivity/constituent-cpd-id + * + *

To create instances of this class use {@link ConstituentCpdIdBuilder}. + * @see ConstituentCpdIdBuilder + * @see ConstituentCpdIdKey + * + */ +public interface ConstituentCpdId + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("constituent-cpd-id"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.virtual.link.connectivity.ConstituentCpdId.class; + } + + /** + * Reference to the profile of an NS constituent. + * + * + * + * @return java.lang.String constituentBaseElementId, or null if not present + */ + @Nullable String getConstituentBaseElementId(); + + /** + * A reference to the descriptor of a connection point attached to one of the + * constituent VNFs and PNFs or to the descriptor of a NS SAP. + * + * + * + * @return java.lang.Object constituentCpdId, or null if not present + */ + @Nullable Object getConstituentCpdId(); + + @Override + ConstituentCpdIdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/virtual/link/connectivity/ConstituentCpdIdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/virtual/link/connectivity/ConstituentCpdIdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..af4183f5d1a9096265df6b8153038b5fd6b7d602 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/virtual/link/connectivity/ConstituentCpdIdBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.virtual.link.connectivity; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ConstituentCpdIdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ConstituentCpdIdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ConstituentCpdIdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ConstituentCpdIdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ConstituentCpdIdBuilder + * @see Builder + * + */ +public class ConstituentCpdIdBuilder implements Builder { + + private String _constituentBaseElementId; + private Object _constituentCpdId; + private ConstituentCpdIdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ConstituentCpdIdBuilder() { + } + + public ConstituentCpdIdBuilder(ConstituentCpdId base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._constituentBaseElementId = base.getConstituentBaseElementId(); + this._constituentCpdId = base.getConstituentCpdId(); + } + + + public ConstituentCpdIdKey key() { + return key; + } + + public String getConstituentBaseElementId() { + return _constituentBaseElementId; + } + + public Object getConstituentCpdId() { + return _constituentCpdId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ConstituentCpdIdBuilder withKey(final ConstituentCpdIdKey key) { + this.key = key; + return this; + } + + public ConstituentCpdIdBuilder setConstituentBaseElementId(final String value) { + this._constituentBaseElementId = value; + return this; + } + + public ConstituentCpdIdBuilder setConstituentCpdId(final Object value) { + this._constituentCpdId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ConstituentCpdIdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ConstituentCpdIdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ConstituentCpdIdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ConstituentCpdIdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ConstituentCpdId build() { + return new ConstituentCpdIdImpl(this); + } + + private static final class ConstituentCpdIdImpl + extends AbstractAugmentable + implements ConstituentCpdId { + + private final String _constituentBaseElementId; + private final Object _constituentCpdId; + private final ConstituentCpdIdKey key; + + ConstituentCpdIdImpl(ConstituentCpdIdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ConstituentCpdIdKey(base.getConstituentBaseElementId()); + } + this._constituentBaseElementId = key.getConstituentBaseElementId(); + this._constituentCpdId = base.getConstituentCpdId(); + } + + @Override + public ConstituentCpdIdKey key() { + return key; + } + + @Override + public String getConstituentBaseElementId() { + return _constituentBaseElementId; + } + + @Override + public Object getConstituentCpdId() { + return _constituentCpdId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_constituentBaseElementId); + result = prime * result + Objects.hashCode(_constituentCpdId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ConstituentCpdId.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ConstituentCpdId other = (ConstituentCpdId)obj; + if (!Objects.equals(_constituentBaseElementId, other.getConstituentBaseElementId())) { + return false; + } + if (!Objects.equals(_constituentCpdId, other.getConstituentCpdId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ConstituentCpdIdImpl otherImpl = (ConstituentCpdIdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ConstituentCpdId"); + CodeHelpers.appendValue(helper, "_constituentBaseElementId", _constituentBaseElementId); + CodeHelpers.appendValue(helper, "_constituentCpdId", _constituentCpdId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/virtual/link/connectivity/ConstituentCpdIdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/virtual/link/connectivity/ConstituentCpdIdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..53dfd326863d082780d73892c405f7d7b28b23e8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/pnf/profile/virtual/link/connectivity/ConstituentCpdIdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.pnf.profile.virtual.link.connectivity; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ConstituentCpdIdKey + implements Identifier { + private static final long serialVersionUID = -6015428103661446636L; + private final String _constituentBaseElementId; + + + public ConstituentCpdIdKey(String _constituentBaseElementId) { + + this._constituentBaseElementId = _constituentBaseElementId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ConstituentCpdIdKey(ConstituentCpdIdKey source) { + this._constituentBaseElementId = source._constituentBaseElementId; + } + + + public String getConstituentBaseElementId() { + return _constituentBaseElementId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_constituentBaseElementId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ConstituentCpdIdKey)) { + return false; + } + final ConstituentCpdIdKey other = (ConstituentCpdIdKey) obj; + if (!Objects.equals(_constituentBaseElementId, other._constituentBaseElementId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ConstituentCpdIdKey.class); + CodeHelpers.appendValue(helper, "_constituentBaseElementId", _constituentBaseElementId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/AffinityOrAntiAffinityGroup.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/AffinityOrAntiAffinityGroup.java new file mode 100644 index 0000000000000000000000000000000000000000..cff94cf8244e5dc0cb89b2e40881e61c4dbb5e2d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/AffinityOrAntiAffinityGroup.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VirtualLinkProfile; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Identifies an affinity or anti-affinity group the VLs instantiated according to + * the VlProfile belong to. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list affinity-or-anti-affinity-group {
+ *   key id;
+ *   leaf id {
+ *     type leafref {
+ *       path ../../../affinity-or-anti-affinity-group/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/virtual-link-profile/affinity-or-anti-affinity-group + * + *

To create instances of this class use {@link AffinityOrAntiAffinityGroupBuilder}. + * @see AffinityOrAntiAffinityGroupBuilder + * @see AffinityOrAntiAffinityGroupKey + * + */ +public interface AffinityOrAntiAffinityGroup + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("affinity-or-anti-affinity-group"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.AffinityOrAntiAffinityGroup.class; + } + + /** + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + @Override + AffinityOrAntiAffinityGroupKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/AffinityOrAntiAffinityGroupBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/AffinityOrAntiAffinityGroupBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..65a55846ff24236c2006c2261078c8cee480c201 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/AffinityOrAntiAffinityGroupBuilder.java @@ -0,0 +1,248 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link AffinityOrAntiAffinityGroupBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AffinityOrAntiAffinityGroupBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AffinityOrAntiAffinityGroupBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AffinityOrAntiAffinityGroupBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AffinityOrAntiAffinityGroupBuilder + * @see Builder + * + */ +public class AffinityOrAntiAffinityGroupBuilder implements Builder { + + private String _id; + private AffinityOrAntiAffinityGroupKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AffinityOrAntiAffinityGroupBuilder() { + } + + public AffinityOrAntiAffinityGroupBuilder(AffinityOrAntiAffinityGroup base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + } + + + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + public String getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AffinityOrAntiAffinityGroupBuilder withKey(final AffinityOrAntiAffinityGroupKey key) { + this.key = key; + return this; + } + + public AffinityOrAntiAffinityGroupBuilder setId(final String value) { + this._id = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AffinityOrAntiAffinityGroupBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AffinityOrAntiAffinityGroupBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public AffinityOrAntiAffinityGroup build() { + return new AffinityOrAntiAffinityGroupImpl(this); + } + + private static final class AffinityOrAntiAffinityGroupImpl + extends AbstractAugmentable + implements AffinityOrAntiAffinityGroup { + + private final String _id; + private final AffinityOrAntiAffinityGroupKey key; + + AffinityOrAntiAffinityGroupImpl(AffinityOrAntiAffinityGroupBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new AffinityOrAntiAffinityGroupKey(base.getId()); + } + this._id = key.getId(); + } + + @Override + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!AffinityOrAntiAffinityGroup.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + AffinityOrAntiAffinityGroup other = (AffinityOrAntiAffinityGroup)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AffinityOrAntiAffinityGroupImpl otherImpl = (AffinityOrAntiAffinityGroupImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("AffinityOrAntiAffinityGroup"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/AffinityOrAntiAffinityGroupKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/AffinityOrAntiAffinityGroupKey.java new file mode 100644 index 0000000000000000000000000000000000000000..e9d4fab406681ee0a53b80f6bd610713015ff955 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/AffinityOrAntiAffinityGroupKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class AffinityOrAntiAffinityGroupKey + implements Identifier { + private static final long serialVersionUID = -4909084403753675647L; + private final String _id; + + + public AffinityOrAntiAffinityGroupKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public AffinityOrAntiAffinityGroupKey(AffinityOrAntiAffinityGroupKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof AffinityOrAntiAffinityGroupKey)) { + return false; + } + final AffinityOrAntiAffinityGroupKey other = (AffinityOrAntiAffinityGroupKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(AffinityOrAntiAffinityGroupKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MaxBitrateRequirements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MaxBitrateRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..88872494f30d8897b99014f1fec7326a9885db76 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MaxBitrateRequirements.java @@ -0,0 +1,46 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VirtualLinkProfile; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies the maximum bitrate requirements for a VL instantiated according to + * this profile. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container max-bitrate-requirements {
+ *   uses link-bitrate-requirements;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/virtual-link-profile/max-bitrate-requirements + * + *

To create instances of this class use {@link MaxBitrateRequirementsBuilder}. + * @see MaxBitrateRequirementsBuilder + * + */ +public interface MaxBitrateRequirements + extends + ChildOf, + Augmentable, + LinkBitrateRequirements +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("max-bitrate-requirements"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.MaxBitrateRequirements.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MaxBitrateRequirementsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MaxBitrateRequirementsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..4bd53041db974c421e479d5a9098855796684dcc --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MaxBitrateRequirementsBuilder.java @@ -0,0 +1,298 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link MaxBitrateRequirementsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     MaxBitrateRequirementsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new MaxBitrateRequirementsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of MaxBitrateRequirementsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see MaxBitrateRequirementsBuilder + * @see Builder + * + */ +public class MaxBitrateRequirementsBuilder implements Builder { + + private Uint64 _leaf; + private Uint64 _root; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public MaxBitrateRequirementsBuilder() { + } + public MaxBitrateRequirementsBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements arg) { + this._root = arg.getRoot(); + this._leaf = arg.getLeaf(); + } + + public MaxBitrateRequirementsBuilder(MaxBitrateRequirements base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements) { + this._root = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements)arg).getRoot(); + this._leaf = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements)arg).getLeaf(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements]"); + } + + public Uint64 getLeaf() { + return _leaf; + } + + public Uint64 getRoot() { + return _root; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public MaxBitrateRequirementsBuilder setLeaf(final Uint64 value) { + this._leaf = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLeaf(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public MaxBitrateRequirementsBuilder setLeaf(final BigInteger value) { + return setLeaf(CodeHelpers.compatUint(value)); + } + + public MaxBitrateRequirementsBuilder setRoot(final Uint64 value) { + this._root = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setRoot(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public MaxBitrateRequirementsBuilder setRoot(final BigInteger value) { + return setRoot(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public MaxBitrateRequirementsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public MaxBitrateRequirementsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public MaxBitrateRequirementsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private MaxBitrateRequirementsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public MaxBitrateRequirements build() { + return new MaxBitrateRequirementsImpl(this); + } + + private static final class MaxBitrateRequirementsImpl + extends AbstractAugmentable + implements MaxBitrateRequirements { + + private final Uint64 _leaf; + private final Uint64 _root; + + MaxBitrateRequirementsImpl(MaxBitrateRequirementsBuilder base) { + super(base.augmentation); + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + @Override + public Uint64 getLeaf() { + return _leaf; + } + + @Override + public Uint64 getRoot() { + return _root; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_leaf); + result = prime * result + Objects.hashCode(_root); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!MaxBitrateRequirements.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + MaxBitrateRequirements other = (MaxBitrateRequirements)obj; + if (!Objects.equals(_leaf, other.getLeaf())) { + return false; + } + if (!Objects.equals(_root, other.getRoot())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + MaxBitrateRequirementsImpl otherImpl = (MaxBitrateRequirementsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("MaxBitrateRequirements"); + CodeHelpers.appendValue(helper, "_leaf", _leaf); + CodeHelpers.appendValue(helper, "_root", _root); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MinBitrateRequirements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MinBitrateRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..687c7bf9546022969ee6a0ce66e3cbf28eaa876f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MinBitrateRequirements.java @@ -0,0 +1,46 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VirtualLinkProfile; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies the minimum bitrate requirements for a VL instantiated according to + * this profile. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container min-bitrate-requirements {
+ *   uses link-bitrate-requirements;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/virtual-link-profile/min-bitrate-requirements + * + *

To create instances of this class use {@link MinBitrateRequirementsBuilder}. + * @see MinBitrateRequirementsBuilder + * + */ +public interface MinBitrateRequirements + extends + ChildOf, + Augmentable, + LinkBitrateRequirements +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("min-bitrate-requirements"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile.MinBitrateRequirements.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MinBitrateRequirementsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MinBitrateRequirementsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..c10fe4340f1233f12eb37f482d335e8b4cb82ccb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/virtual/link/profile/MinBitrateRequirementsBuilder.java @@ -0,0 +1,298 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.virtual.link.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link MinBitrateRequirementsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     MinBitrateRequirementsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new MinBitrateRequirementsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of MinBitrateRequirementsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see MinBitrateRequirementsBuilder + * @see Builder + * + */ +public class MinBitrateRequirementsBuilder implements Builder { + + private Uint64 _leaf; + private Uint64 _root; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public MinBitrateRequirementsBuilder() { + } + public MinBitrateRequirementsBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements arg) { + this._root = arg.getRoot(); + this._leaf = arg.getLeaf(); + } + + public MinBitrateRequirementsBuilder(MinBitrateRequirements base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements) { + this._root = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements)arg).getRoot(); + this._leaf = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements)arg).getLeaf(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LinkBitrateRequirements]"); + } + + public Uint64 getLeaf() { + return _leaf; + } + + public Uint64 getRoot() { + return _root; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public MinBitrateRequirementsBuilder setLeaf(final Uint64 value) { + this._leaf = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLeaf(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public MinBitrateRequirementsBuilder setLeaf(final BigInteger value) { + return setLeaf(CodeHelpers.compatUint(value)); + } + + public MinBitrateRequirementsBuilder setRoot(final Uint64 value) { + this._root = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setRoot(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public MinBitrateRequirementsBuilder setRoot(final BigInteger value) { + return setRoot(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public MinBitrateRequirementsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public MinBitrateRequirementsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public MinBitrateRequirementsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private MinBitrateRequirementsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public MinBitrateRequirements build() { + return new MinBitrateRequirementsImpl(this); + } + + private static final class MinBitrateRequirementsImpl + extends AbstractAugmentable + implements MinBitrateRequirements { + + private final Uint64 _leaf; + private final Uint64 _root; + + MinBitrateRequirementsImpl(MinBitrateRequirementsBuilder base) { + super(base.augmentation); + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + @Override + public Uint64 getLeaf() { + return _leaf; + } + + @Override + public Uint64 getRoot() { + return _root; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_leaf); + result = prime * result + Objects.hashCode(_root); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!MinBitrateRequirements.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + MinBitrateRequirements other = (MinBitrateRequirements)obj; + if (!Objects.equals(_leaf, other.getLeaf())) { + return false; + } + if (!Objects.equals(_root, other.getRoot())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + MinBitrateRequirementsImpl otherImpl = (MinBitrateRequirementsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("MinBitrateRequirements"); + CodeHelpers.appendValue(helper, "_leaf", _leaf); + CodeHelpers.appendValue(helper, "_root", _root); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/AffinityOrAntiAffinityGroup.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/AffinityOrAntiAffinityGroup.java new file mode 100644 index 0000000000000000000000000000000000000000..159997087f4ab54cfb9b1b39009a20e1f1f7a56a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/AffinityOrAntiAffinityGroup.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VnfProfile; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Identifier(s) of the affinity or anti-affinity group(s) the VnfProfile belongs + * to. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list affinity-or-anti-affinity-group {
+ *   key id;
+ *   leaf id {
+ *     type leafref {
+ *       path ../../../affinity-or-anti-affinity-group/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/vnf-profile/affinity-or-anti-affinity-group + * + *

To create instances of this class use {@link AffinityOrAntiAffinityGroupBuilder}. + * @see AffinityOrAntiAffinityGroupBuilder + * @see AffinityOrAntiAffinityGroupKey + * + */ +public interface AffinityOrAntiAffinityGroup + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("affinity-or-anti-affinity-group"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.AffinityOrAntiAffinityGroup.class; + } + + /** + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + @Override + AffinityOrAntiAffinityGroupKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/AffinityOrAntiAffinityGroupBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/AffinityOrAntiAffinityGroupBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..d17abd35c4a44aa70a64f2ba3a5cd6d57cabec47 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/AffinityOrAntiAffinityGroupBuilder.java @@ -0,0 +1,248 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link AffinityOrAntiAffinityGroupBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AffinityOrAntiAffinityGroupBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AffinityOrAntiAffinityGroupBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AffinityOrAntiAffinityGroupBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AffinityOrAntiAffinityGroupBuilder + * @see Builder + * + */ +public class AffinityOrAntiAffinityGroupBuilder implements Builder { + + private String _id; + private AffinityOrAntiAffinityGroupKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AffinityOrAntiAffinityGroupBuilder() { + } + + public AffinityOrAntiAffinityGroupBuilder(AffinityOrAntiAffinityGroup base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + } + + + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + public String getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AffinityOrAntiAffinityGroupBuilder withKey(final AffinityOrAntiAffinityGroupKey key) { + this.key = key; + return this; + } + + public AffinityOrAntiAffinityGroupBuilder setId(final String value) { + this._id = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AffinityOrAntiAffinityGroupBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AffinityOrAntiAffinityGroupBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public AffinityOrAntiAffinityGroup build() { + return new AffinityOrAntiAffinityGroupImpl(this); + } + + private static final class AffinityOrAntiAffinityGroupImpl + extends AbstractAugmentable + implements AffinityOrAntiAffinityGroup { + + private final String _id; + private final AffinityOrAntiAffinityGroupKey key; + + AffinityOrAntiAffinityGroupImpl(AffinityOrAntiAffinityGroupBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new AffinityOrAntiAffinityGroupKey(base.getId()); + } + this._id = key.getId(); + } + + @Override + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!AffinityOrAntiAffinityGroup.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + AffinityOrAntiAffinityGroup other = (AffinityOrAntiAffinityGroup)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AffinityOrAntiAffinityGroupImpl otherImpl = (AffinityOrAntiAffinityGroupImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("AffinityOrAntiAffinityGroup"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/AffinityOrAntiAffinityGroupKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/AffinityOrAntiAffinityGroupKey.java new file mode 100644 index 0000000000000000000000000000000000000000..092bb9d8420f42695135cfae22fcc25546c7df98 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/AffinityOrAntiAffinityGroupKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class AffinityOrAntiAffinityGroupKey + implements Identifier { + private static final long serialVersionUID = -4909084403753675647L; + private final String _id; + + + public AffinityOrAntiAffinityGroupKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public AffinityOrAntiAffinityGroupKey(AffinityOrAntiAffinityGroupKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof AffinityOrAntiAffinityGroupKey)) { + return false; + } + final AffinityOrAntiAffinityGroupKey other = (AffinityOrAntiAffinityGroupKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(AffinityOrAntiAffinityGroupKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/VirtualLinkConnectivity.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/VirtualLinkConnectivity.java new file mode 100644 index 0000000000000000000000000000000000000000..6fac8b1f0179fcd753fa3c71d873de001e9c93fb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/VirtualLinkConnectivity.java @@ -0,0 +1,101 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VnfProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.virtual.link.connectivity.ConstituentCpdId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.virtual.link.connectivity.ConstituentCpdIdKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Defines the connection information of the VNF, it contains connection + * relationship between a VNF connection point and a NS Virtual Link. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list virtual-link-connectivity {
+ *   key virtual-link-profile-id;
+ *   leaf virtual-link-profile-id {
+ *     type leafref {
+ *       path ../../../virtual-link-profile/id;
+ *     }
+ *   }
+ *   list constituent-cpd-id {
+ *     key constituent-base-element-id;
+ *     leaf constituent-base-element-id {
+ *       type leafref {
+ *         path ../../../id;
+ *       }
+ *     }
+ *     leaf constituent-cpd-id {
+ *       type leafref {
+ *         path deref(../../../vnfd-id)/../ext-cpd/id;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/vnf-profile/virtual-link-connectivity + * + *

To create instances of this class use {@link VirtualLinkConnectivityBuilder}. + * @see VirtualLinkConnectivityBuilder + * @see VirtualLinkConnectivityKey + * + */ +public interface VirtualLinkConnectivity + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-link-connectivity"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.VirtualLinkConnectivity.class; + } + + /** + * Reference an NS VL profile. + * + * + * + * @return java.lang.String virtualLinkProfileId, or null if not present + */ + @Nullable String getVirtualLinkProfileId(); + + /** + * Describes a connection point on a VNF/PNF or a SAP which connects to virtual + * links instantiated from the profile identified in the virtualLinkProfileId + * attribute. + * + * + * + * @return java.util.Map constituentCpdId, or null if not present + */ + @Nullable Map getConstituentCpdId(); + + /** + * @return java.util.Map constituentCpdId, or an empty list if it is not present + */ + default @NonNull Map nonnullConstituentCpdId() { + return CodeHelpers.nonnull(getConstituentCpdId()); + } + + @Override + VirtualLinkConnectivityKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/VirtualLinkConnectivityBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/VirtualLinkConnectivityBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..17e55069ac2094b6632e99221be1c2913f57e7d2 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/VirtualLinkConnectivityBuilder.java @@ -0,0 +1,291 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.virtual.link.connectivity.ConstituentCpdId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.virtual.link.connectivity.ConstituentCpdIdKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualLinkConnectivityBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkConnectivityBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkConnectivityBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkConnectivityBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkConnectivityBuilder + * @see Builder + * + */ +public class VirtualLinkConnectivityBuilder implements Builder { + + private Map _constituentCpdId; + private String _virtualLinkProfileId; + private VirtualLinkConnectivityKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualLinkConnectivityBuilder() { + } + + public VirtualLinkConnectivityBuilder(VirtualLinkConnectivity base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._virtualLinkProfileId = base.getVirtualLinkProfileId(); + this._constituentCpdId = base.getConstituentCpdId(); + } + + + public VirtualLinkConnectivityKey key() { + return key; + } + + public Map getConstituentCpdId() { + return _constituentCpdId; + } + + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VirtualLinkConnectivityBuilder withKey(final VirtualLinkConnectivityKey key) { + this.key = key; + return this; + } + public VirtualLinkConnectivityBuilder setConstituentCpdId(final Map values) { + this._constituentCpdId = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setConstituentCpdId(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkConnectivityBuilder setConstituentCpdId(final List values) { + return setConstituentCpdId(CodeHelpers.compatMap(values)); + } + + public VirtualLinkConnectivityBuilder setVirtualLinkProfileId(final String value) { + this._virtualLinkProfileId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualLinkConnectivityBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkConnectivityBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualLinkConnectivityBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualLinkConnectivityBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualLinkConnectivity build() { + return new VirtualLinkConnectivityImpl(this); + } + + private static final class VirtualLinkConnectivityImpl + extends AbstractAugmentable + implements VirtualLinkConnectivity { + + private final Map _constituentCpdId; + private final String _virtualLinkProfileId; + private final VirtualLinkConnectivityKey key; + + VirtualLinkConnectivityImpl(VirtualLinkConnectivityBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VirtualLinkConnectivityKey(base.getVirtualLinkProfileId()); + } + this._virtualLinkProfileId = key.getVirtualLinkProfileId(); + this._constituentCpdId = CodeHelpers.emptyToNull(base.getConstituentCpdId()); + } + + @Override + public VirtualLinkConnectivityKey key() { + return key; + } + + @Override + public Map getConstituentCpdId() { + return _constituentCpdId; + } + + @Override + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_constituentCpdId); + result = prime * result + Objects.hashCode(_virtualLinkProfileId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkConnectivity.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkConnectivity other = (VirtualLinkConnectivity)obj; + if (!Objects.equals(_constituentCpdId, other.getConstituentCpdId())) { + return false; + } + if (!Objects.equals(_virtualLinkProfileId, other.getVirtualLinkProfileId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualLinkConnectivityImpl otherImpl = (VirtualLinkConnectivityImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkConnectivity"); + CodeHelpers.appendValue(helper, "_constituentCpdId", _constituentCpdId); + CodeHelpers.appendValue(helper, "_virtualLinkProfileId", _virtualLinkProfileId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/VirtualLinkConnectivityKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/VirtualLinkConnectivityKey.java new file mode 100644 index 0000000000000000000000000000000000000000..4d1b23f8e83915e5293ac14566a20094933270fa --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/VirtualLinkConnectivityKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VirtualLinkConnectivityKey + implements Identifier { + private static final long serialVersionUID = -1012322664145801683L; + private final String _virtualLinkProfileId; + + + public VirtualLinkConnectivityKey(String _virtualLinkProfileId) { + + this._virtualLinkProfileId = _virtualLinkProfileId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VirtualLinkConnectivityKey(VirtualLinkConnectivityKey source) { + this._virtualLinkProfileId = source._virtualLinkProfileId; + } + + + public String getVirtualLinkProfileId() { + return _virtualLinkProfileId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_virtualLinkProfileId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VirtualLinkConnectivityKey)) { + return false; + } + final VirtualLinkConnectivityKey other = (VirtualLinkConnectivityKey) obj; + if (!Objects.equals(_virtualLinkProfileId, other._virtualLinkProfileId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VirtualLinkConnectivityKey.class); + CodeHelpers.appendValue(helper, "_virtualLinkProfileId", _virtualLinkProfileId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/virtual/link/connectivity/ConstituentCpdId.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/virtual/link/connectivity/ConstituentCpdId.java new file mode 100644 index 0000000000000000000000000000000000000000..18631110501455df147f6fa41b385a7ebdc4a5e6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/virtual/link/connectivity/ConstituentCpdId.java @@ -0,0 +1,83 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.virtual.link.connectivity; +import java.lang.Class; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.VirtualLinkConnectivity; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes a connection point on a VNF/PNF or a SAP which connects to virtual + * links instantiated from the profile identified in the virtualLinkProfileId + * attribute. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list constituent-cpd-id {
+ *   key constituent-base-element-id;
+ *   leaf constituent-base-element-id {
+ *     type leafref {
+ *       path ../../../id;
+ *     }
+ *   }
+ *   leaf constituent-cpd-id {
+ *     type leafref {
+ *       path deref(../../../vnfd-id)/../ext-cpd/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/df/vnf-profile/virtual-link-connectivity/constituent-cpd-id + * + *

To create instances of this class use {@link ConstituentCpdIdBuilder}. + * @see ConstituentCpdIdBuilder + * @see ConstituentCpdIdKey + * + */ +public interface ConstituentCpdId + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("constituent-cpd-id"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.virtual.link.connectivity.ConstituentCpdId.class; + } + + /** + * Reference to the profile of an NS constituent. + * + * + * + * @return java.lang.String constituentBaseElementId, or null if not present + */ + @Nullable String getConstituentBaseElementId(); + + /** + * A reference to the descriptor of a connection point attached to one of the + * constituent VNFs and PNFs or to the descriptor of a NS SAP. + * + * + * + * @return java.lang.Object constituentCpdId, or null if not present + */ + @Nullable Object getConstituentCpdId(); + + @Override + ConstituentCpdIdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/virtual/link/connectivity/ConstituentCpdIdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/virtual/link/connectivity/ConstituentCpdIdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..e929a1682e4a40cf66d7fe2a5ec5f22b6558b2a6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/virtual/link/connectivity/ConstituentCpdIdBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.virtual.link.connectivity; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ConstituentCpdIdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ConstituentCpdIdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ConstituentCpdIdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ConstituentCpdIdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ConstituentCpdIdBuilder + * @see Builder + * + */ +public class ConstituentCpdIdBuilder implements Builder { + + private String _constituentBaseElementId; + private Object _constituentCpdId; + private ConstituentCpdIdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ConstituentCpdIdBuilder() { + } + + public ConstituentCpdIdBuilder(ConstituentCpdId base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._constituentBaseElementId = base.getConstituentBaseElementId(); + this._constituentCpdId = base.getConstituentCpdId(); + } + + + public ConstituentCpdIdKey key() { + return key; + } + + public String getConstituentBaseElementId() { + return _constituentBaseElementId; + } + + public Object getConstituentCpdId() { + return _constituentCpdId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ConstituentCpdIdBuilder withKey(final ConstituentCpdIdKey key) { + this.key = key; + return this; + } + + public ConstituentCpdIdBuilder setConstituentBaseElementId(final String value) { + this._constituentBaseElementId = value; + return this; + } + + public ConstituentCpdIdBuilder setConstituentCpdId(final Object value) { + this._constituentCpdId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ConstituentCpdIdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ConstituentCpdIdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ConstituentCpdIdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ConstituentCpdIdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ConstituentCpdId build() { + return new ConstituentCpdIdImpl(this); + } + + private static final class ConstituentCpdIdImpl + extends AbstractAugmentable + implements ConstituentCpdId { + + private final String _constituentBaseElementId; + private final Object _constituentCpdId; + private final ConstituentCpdIdKey key; + + ConstituentCpdIdImpl(ConstituentCpdIdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ConstituentCpdIdKey(base.getConstituentBaseElementId()); + } + this._constituentBaseElementId = key.getConstituentBaseElementId(); + this._constituentCpdId = base.getConstituentCpdId(); + } + + @Override + public ConstituentCpdIdKey key() { + return key; + } + + @Override + public String getConstituentBaseElementId() { + return _constituentBaseElementId; + } + + @Override + public Object getConstituentCpdId() { + return _constituentCpdId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_constituentBaseElementId); + result = prime * result + Objects.hashCode(_constituentCpdId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ConstituentCpdId.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ConstituentCpdId other = (ConstituentCpdId)obj; + if (!Objects.equals(_constituentBaseElementId, other.getConstituentBaseElementId())) { + return false; + } + if (!Objects.equals(_constituentCpdId, other.getConstituentCpdId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ConstituentCpdIdImpl otherImpl = (ConstituentCpdIdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ConstituentCpdId"); + CodeHelpers.appendValue(helper, "_constituentBaseElementId", _constituentBaseElementId); + CodeHelpers.appendValue(helper, "_constituentCpdId", _constituentCpdId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/virtual/link/connectivity/ConstituentCpdIdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/virtual/link/connectivity/ConstituentCpdIdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..3487c06caf3f7ebe03d1fe60f805c85ed2dae750 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/df/vnf/profile/virtual/link/connectivity/ConstituentCpdIdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.vnf.profile.virtual.link.connectivity; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ConstituentCpdIdKey + implements Identifier { + private static final long serialVersionUID = -6015428103661446636L; + private final String _constituentBaseElementId; + + + public ConstituentCpdIdKey(String _constituentBaseElementId) { + + this._constituentBaseElementId = _constituentBaseElementId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ConstituentCpdIdKey(ConstituentCpdIdKey source) { + this._constituentBaseElementId = source._constituentBaseElementId; + } + + + public String getConstituentBaseElementId() { + return _constituentBaseElementId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_constituentBaseElementId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ConstituentCpdIdKey)) { + return false; + } + final ConstituentCpdIdKey other = (ConstituentCpdIdKey) obj; + if (!Objects.equals(_constituentBaseElementId, other._constituentBaseElementId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ConstituentCpdIdKey.class); + CodeHelpers.appendValue(helper, "_constituentBaseElementId", _constituentBaseElementId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/CpdOrVirtualLink.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/CpdOrVirtualLink.java new file mode 100644 index 0000000000000000000000000000000000000000..46232d0932ace74f02abf8f2ed71480ef0ee4b4b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/CpdOrVirtualLink.java @@ -0,0 +1,82 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Sapd; +import org.opendaylight.yangtools.yang.binding.ChoiceIn; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * choice cpd-or-virtual-link {
+ *   case virtual-link-desc {
+ *     leaf virtual-link-desc {
+ *       type leafref {
+ *         path ../../virtual-link-desc/id;
+ *       }
+ *     }
+ *   }
+ *   case vnf {
+ *     container vnf {
+ *       leaf vnfd-id {
+ *         type leafref {
+ *           path ../../../../vnfd/id;
+ *         }
+ *         must boolean(../../../vnfd-id[.=current()]);
+ *       }
+ *       leaf ext-cpd-id {
+ *         type leafref {
+ *           path deref(../vnfd-id)/../ext-cpd/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   case pnf {
+ *     container pnf {
+ *       leaf pnfd-id {
+ *         type leafref {
+ *           path ../../../../pnfd/id;
+ *         }
+ *         must boolean(../pnfd-id[.=current()]);
+ *       }
+ *       leaf ext-cpd-id {
+ *         type leafref {
+ *           path deref(../pnfd-id)/../ext-cpd/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   case ns {
+ *     container ns {
+ *       leaf nsd-id {
+ *         type leafref {
+ *           path ../../../../nsd/id;
+ *         }
+ *         must boolean(../nsd-id[.=current()]);
+ *       }
+ *       leaf ext-cpd-id {
+ *         type leafref {
+ *           path deref(../nsd-id)/../sapd/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/sapd/cpd-or-virtual-link + * + */ +public interface CpdOrVirtualLink + extends + ChoiceIn +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("cpd-or-virtual-link"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/Ns.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/Ns.java new file mode 100644 index 0000000000000000000000000000000000000000..c9bb4d3870b32e07bd68dbd0b51355b1fd5f1fdb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/Ns.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.CpdOrVirtualLink; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface Ns + extends + DataObject, + Augmentable, + CpdOrVirtualLink +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ns"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.Ns.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.ns.Ns ns, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.ns.@Nullable Ns getNs(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/NsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/NsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..d68eb128627dd919530f29f2edc591711fa38068 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/NsBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsBuilder + * @see Builder + * + */ +public class NsBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.ns.Ns _ns; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsBuilder() { + } + + public NsBuilder(Ns base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._ns = base.getNs(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.ns.Ns getNs() { + return _ns; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public NsBuilder setNs(final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.ns.Ns value) { + this._ns = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Ns build() { + return new NsImpl(this); + } + + private static final class NsImpl + extends AbstractAugmentable + implements Ns { + + private final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.ns.Ns _ns; + + NsImpl(NsBuilder base) { + super(base.augmentation); + this._ns = base.getNs(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.ns.Ns getNs() { + return _ns; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_ns); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Ns.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Ns other = (Ns)obj; + if (!Objects.equals(_ns, other.getNs())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsImpl otherImpl = (NsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Ns"); + CodeHelpers.appendValue(helper, "_ns", _ns); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/Pnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/Pnf.java new file mode 100644 index 0000000000000000000000000000000000000000..2d80b7df3cfd55c487133e82f642e85d64868eb4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/Pnf.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.CpdOrVirtualLink; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface Pnf + extends + DataObject, + Augmentable, + CpdOrVirtualLink +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pnf"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.Pnf.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.pnf.Pnf pnf, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.pnf.@Nullable Pnf getPnf(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/PnfBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/PnfBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..eaf0ed5916d63f93cc1e8116721b9ac62b8f7934 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/PnfBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PnfBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PnfBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PnfBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PnfBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PnfBuilder + * @see Builder + * + */ +public class PnfBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.pnf.Pnf _pnf; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PnfBuilder() { + } + + public PnfBuilder(Pnf base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._pnf = base.getPnf(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.pnf.Pnf getPnf() { + return _pnf; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public PnfBuilder setPnf(final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.pnf.Pnf value) { + this._pnf = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PnfBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PnfBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PnfBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PnfBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Pnf build() { + return new PnfImpl(this); + } + + private static final class PnfImpl + extends AbstractAugmentable + implements Pnf { + + private final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.pnf.Pnf _pnf; + + PnfImpl(PnfBuilder base) { + super(base.augmentation); + this._pnf = base.getPnf(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.pnf.Pnf getPnf() { + return _pnf; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_pnf); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Pnf.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Pnf other = (Pnf)obj; + if (!Objects.equals(_pnf, other.getPnf())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PnfImpl otherImpl = (PnfImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Pnf"); + CodeHelpers.appendValue(helper, "_pnf", _pnf); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/VirtualLinkDesc.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/VirtualLinkDesc.java new file mode 100644 index 0000000000000000000000000000000000000000..265b5f11c72d0000c9bea3837ae75039221b0959 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/VirtualLinkDesc.java @@ -0,0 +1,40 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.CpdOrVirtualLink; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface VirtualLinkDesc + extends + DataObject, + Augmentable, + CpdOrVirtualLink +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-link-desc"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.VirtualLinkDesc.class; + } + + /** + * References the descriptor of the NS VL instance to which the SAP instantiated + * from this SAPD connects to. + * + * + * + * @return java.lang.String virtualLinkDesc, or null if not present + */ + @Nullable String getVirtualLinkDesc(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/VirtualLinkDescBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/VirtualLinkDescBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..0d7fad537f142d0a89b1a2f24919be28e0a7e422 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/VirtualLinkDescBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualLinkDescBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkDescBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkDescBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkDescBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkDescBuilder + * @see Builder + * + */ +public class VirtualLinkDescBuilder implements Builder { + + private String _virtualLinkDesc; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualLinkDescBuilder() { + } + + public VirtualLinkDescBuilder(VirtualLinkDesc base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._virtualLinkDesc = base.getVirtualLinkDesc(); + } + + + public String getVirtualLinkDesc() { + return _virtualLinkDesc; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VirtualLinkDescBuilder setVirtualLinkDesc(final String value) { + this._virtualLinkDesc = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualLinkDescBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkDescBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualLinkDescBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualLinkDescBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualLinkDesc build() { + return new VirtualLinkDescImpl(this); + } + + private static final class VirtualLinkDescImpl + extends AbstractAugmentable + implements VirtualLinkDesc { + + private final String _virtualLinkDesc; + + VirtualLinkDescImpl(VirtualLinkDescBuilder base) { + super(base.augmentation); + this._virtualLinkDesc = base.getVirtualLinkDesc(); + } + + @Override + public String getVirtualLinkDesc() { + return _virtualLinkDesc; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_virtualLinkDesc); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkDesc.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkDesc other = (VirtualLinkDesc)obj; + if (!Objects.equals(_virtualLinkDesc, other.getVirtualLinkDesc())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualLinkDescImpl otherImpl = (VirtualLinkDescImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkDesc"); + CodeHelpers.appendValue(helper, "_virtualLinkDesc", _virtualLinkDesc); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/Vnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/Vnf.java new file mode 100644 index 0000000000000000000000000000000000000000..04c279f51915c4059413e67b1f20d49b7c473bcb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/Vnf.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.CpdOrVirtualLink; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface Vnf + extends + DataObject, + Augmentable, + CpdOrVirtualLink +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnf"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.Vnf.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.vnf.Vnf vnf, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.vnf.@Nullable Vnf getVnf(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/VnfBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/VnfBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..3bc3dc5e22c36ada79e98724a7c17519cf449455 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/VnfBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VnfBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfBuilder + * @see Builder + * + */ +public class VnfBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.vnf.Vnf _vnf; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfBuilder() { + } + + public VnfBuilder(Vnf base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._vnf = base.getVnf(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.vnf.Vnf getVnf() { + return _vnf; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VnfBuilder setVnf(final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.vnf.Vnf value) { + this._vnf = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Vnf build() { + return new VnfImpl(this); + } + + private static final class VnfImpl + extends AbstractAugmentable + implements Vnf { + + private final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.vnf.Vnf _vnf; + + VnfImpl(VnfBuilder base) { + super(base.augmentation); + this._vnf = base.getVnf(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.vnf.Vnf getVnf() { + return _vnf; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_vnf); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vnf.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vnf other = (Vnf)obj; + if (!Objects.equals(_vnf, other.getVnf())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfImpl otherImpl = (VnfImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vnf"); + CodeHelpers.appendValue(helper, "_vnf", _vnf); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/ns/Ns.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/ns/Ns.java new file mode 100644 index 0000000000000000000000000000000000000000..3b093b1ea5c453404d3a578e16ba3ba2ea26bb9b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/ns/Ns.java @@ -0,0 +1,64 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.ns; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Sapd; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container ns {
+ *   leaf nsd-id {
+ *     type leafref {
+ *       path ../../../../nsd/id;
+ *     }
+ *     must boolean(../nsd-id[.=current()]);
+ *   }
+ *   leaf ext-cpd-id {
+ *     type leafref {
+ *       path deref(../nsd-id)/../sapd/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/sapd/cpd-or-virtual-link/ns/ns + * + *

To create instances of this class use {@link NsBuilder}. + * @see NsBuilder + * + */ +public interface Ns + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ns"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.ns.Ns.class; + } + + /** + * @return java.lang.String nsdId, or null if not present + */ + @Nullable String getNsdId(); + + /** + * @return java.lang.String extCpdId, or null if not present + */ + @Nullable String getExtCpdId(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/ns/NsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/ns/NsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..071fd3c7a7233670f0db460a3cbd12aafb22f3dd --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/ns/NsBuilder.java @@ -0,0 +1,250 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.ns; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsBuilder + * @see Builder + * + */ +public class NsBuilder implements Builder { + + private String _extCpdId; + private String _nsdId; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsBuilder() { + } + + public NsBuilder(Ns base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._extCpdId = base.getExtCpdId(); + this._nsdId = base.getNsdId(); + } + + + public String getExtCpdId() { + return _extCpdId; + } + + public String getNsdId() { + return _nsdId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public NsBuilder setExtCpdId(final String value) { + this._extCpdId = value; + return this; + } + + public NsBuilder setNsdId(final String value) { + this._nsdId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Ns build() { + return new NsImpl(this); + } + + private static final class NsImpl + extends AbstractAugmentable + implements Ns { + + private final String _extCpdId; + private final String _nsdId; + + NsImpl(NsBuilder base) { + super(base.augmentation); + this._extCpdId = base.getExtCpdId(); + this._nsdId = base.getNsdId(); + } + + @Override + public String getExtCpdId() { + return _extCpdId; + } + + @Override + public String getNsdId() { + return _nsdId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_extCpdId); + result = prime * result + Objects.hashCode(_nsdId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Ns.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Ns other = (Ns)obj; + if (!Objects.equals(_extCpdId, other.getExtCpdId())) { + return false; + } + if (!Objects.equals(_nsdId, other.getNsdId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsImpl otherImpl = (NsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Ns"); + CodeHelpers.appendValue(helper, "_extCpdId", _extCpdId); + CodeHelpers.appendValue(helper, "_nsdId", _nsdId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/pnf/Pnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/pnf/Pnf.java new file mode 100644 index 0000000000000000000000000000000000000000..6b2c1f4e1545bdc71b7deddd811d4f7fc3e92581 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/pnf/Pnf.java @@ -0,0 +1,64 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.pnf; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Sapd; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container pnf {
+ *   leaf pnfd-id {
+ *     type leafref {
+ *       path ../../../../pnfd/id;
+ *     }
+ *     must boolean(../pnfd-id[.=current()]);
+ *   }
+ *   leaf ext-cpd-id {
+ *     type leafref {
+ *       path deref(../pnfd-id)/../ext-cpd/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/sapd/cpd-or-virtual-link/pnf/pnf + * + *

To create instances of this class use {@link PnfBuilder}. + * @see PnfBuilder + * + */ +public interface Pnf + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pnf"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.pnf.Pnf.class; + } + + /** + * @return java.lang.String pnfdId, or null if not present + */ + @Nullable String getPnfdId(); + + /** + * @return java.lang.String extCpdId, or null if not present + */ + @Nullable String getExtCpdId(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/pnf/PnfBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/pnf/PnfBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..f4e48e5ade17f12ac71ee0b1968fc9f806b78e8e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/pnf/PnfBuilder.java @@ -0,0 +1,250 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.pnf; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PnfBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PnfBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PnfBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PnfBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PnfBuilder + * @see Builder + * + */ +public class PnfBuilder implements Builder { + + private String _extCpdId; + private String _pnfdId; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PnfBuilder() { + } + + public PnfBuilder(Pnf base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._extCpdId = base.getExtCpdId(); + this._pnfdId = base.getPnfdId(); + } + + + public String getExtCpdId() { + return _extCpdId; + } + + public String getPnfdId() { + return _pnfdId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public PnfBuilder setExtCpdId(final String value) { + this._extCpdId = value; + return this; + } + + public PnfBuilder setPnfdId(final String value) { + this._pnfdId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PnfBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PnfBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PnfBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PnfBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Pnf build() { + return new PnfImpl(this); + } + + private static final class PnfImpl + extends AbstractAugmentable + implements Pnf { + + private final String _extCpdId; + private final String _pnfdId; + + PnfImpl(PnfBuilder base) { + super(base.augmentation); + this._extCpdId = base.getExtCpdId(); + this._pnfdId = base.getPnfdId(); + } + + @Override + public String getExtCpdId() { + return _extCpdId; + } + + @Override + public String getPnfdId() { + return _pnfdId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_extCpdId); + result = prime * result + Objects.hashCode(_pnfdId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Pnf.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Pnf other = (Pnf)obj; + if (!Objects.equals(_extCpdId, other.getExtCpdId())) { + return false; + } + if (!Objects.equals(_pnfdId, other.getPnfdId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PnfImpl otherImpl = (PnfImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Pnf"); + CodeHelpers.appendValue(helper, "_extCpdId", _extCpdId); + CodeHelpers.appendValue(helper, "_pnfdId", _pnfdId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/vnf/Vnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/vnf/Vnf.java new file mode 100644 index 0000000000000000000000000000000000000000..19e89aa10117c631e9d720134cc79291ec0c3a4e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/vnf/Vnf.java @@ -0,0 +1,64 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.vnf; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Sapd; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container vnf {
+ *   leaf vnfd-id {
+ *     type leafref {
+ *       path ../../../../vnfd/id;
+ *     }
+ *     must boolean(../../../vnfd-id[.=current()]);
+ *   }
+ *   leaf ext-cpd-id {
+ *     type leafref {
+ *       path deref(../vnfd-id)/../ext-cpd/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/sapd/cpd-or-virtual-link/vnf/vnf + * + *

To create instances of this class use {@link VnfBuilder}. + * @see VnfBuilder + * + */ +public interface Vnf + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnf"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.vnf.Vnf.class; + } + + /** + * @return java.lang.String vnfdId, or null if not present + */ + @Nullable String getVnfdId(); + + /** + * @return java.lang.String extCpdId, or null if not present + */ + @Nullable String getExtCpdId(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/vnf/VnfBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/vnf/VnfBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..c8f77737cb413772051f8dc957a44eb45800849b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/sapd/cpd/or/virtual/link/vnf/VnfBuilder.java @@ -0,0 +1,250 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.sapd.cpd.or.virtual.link.vnf; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VnfBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfBuilder + * @see Builder + * + */ +public class VnfBuilder implements Builder { + + private String _extCpdId; + private String _vnfdId; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfBuilder() { + } + + public VnfBuilder(Vnf base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._extCpdId = base.getExtCpdId(); + this._vnfdId = base.getVnfdId(); + } + + + public String getExtCpdId() { + return _extCpdId; + } + + public String getVnfdId() { + return _vnfdId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VnfBuilder setExtCpdId(final String value) { + this._extCpdId = value; + return this; + } + + public VnfBuilder setVnfdId(final String value) { + this._vnfdId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Vnf build() { + return new VnfImpl(this); + } + + private static final class VnfImpl + extends AbstractAugmentable + implements Vnf { + + private final String _extCpdId; + private final String _vnfdId; + + VnfImpl(VnfBuilder base) { + super(base.augmentation); + this._extCpdId = base.getExtCpdId(); + this._vnfdId = base.getVnfdId(); + } + + @Override + public String getExtCpdId() { + return _extCpdId; + } + + @Override + public String getVnfdId() { + return _vnfdId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_extCpdId); + result = prime * result + Objects.hashCode(_vnfdId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vnf.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vnf other = (Vnf)obj; + if (!Objects.equals(_extCpdId, other.getExtCpdId())) { + return false; + } + if (!Objects.equals(_vnfdId, other.getVnfdId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfImpl otherImpl = (VnfImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vnf"); + CodeHelpers.appendValue(helper, "_extCpdId", _extCpdId); + CodeHelpers.appendValue(helper, "_vnfdId", _vnfdId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/Df.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/Df.java new file mode 100644 index 0000000000000000000000000000000000000000..fbdf5fb818eb294b14d059e6f73610615809e99d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/Df.java @@ -0,0 +1,181 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VirtualLinkDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.df.Qos; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The VirtualLinkDf information element specifies properties for instantiating a + * VL according to a specific flavour. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list df {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   container qos {
+ *     presence "VL QoS parameters";
+ *     leaf latency {
+ *       type uint32;
+ *       units ms;
+ *     }
+ *     leaf packet-delay-variation {
+ *       type uint32;
+ *       units ms;
+ *     }
+ *     leaf packet-loss-ratio {
+ *       type decimal64 {
+ *         fraction-digits 2;
+ *         range 0..1.00;
+ *       }
+ *     }
+ *     leaf priority {
+ *       type uint32;
+ *     }
+ *   }
+ *   leaf service-availability-level {
+ *     type enumeration {
+ *       enum level-1;
+ *       enum level-2;
+ *       enum level-3;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/virtual-link-desc/df + * + *

To create instances of this class use {@link DfBuilder}. + * @see DfBuilder + * @see DfKey + * + */ +public interface Df + extends + ChildOf, + Augmentable, + Identifiable +{ + + + public enum ServiceAvailabilityLevel implements Enumeration { + Level1(0, "level-1"), + + Level2(1, "level-2"), + + Level3(2, "level-3") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (ServiceAvailabilityLevel enumItem : ServiceAvailabilityLevel.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private ServiceAvailabilityLevel(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding ServiceAvailabilityLevel item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding ServiceAvailabilityLevel item, or null if no such item exists + */ + public static ServiceAvailabilityLevel forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("df"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.Df.class; + } + + /** + * Identifies this VirtualLinkDf information element within a VLD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * The QoS information element specifies quality of service parameters applicable + * to a VL. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.df.Qos qos, or null if not present + */ + @Nullable Qos getQos(); + + /** + * Specifies one of the three levels defined in ETSI ETSI GS NFV-REL 001 [i.5] * + * Level 1. * Level 2. * Level 3. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.Df.ServiceAvailabilityLevel serviceAvailabilityLevel, or null if not present + */ + @Nullable ServiceAvailabilityLevel getServiceAvailabilityLevel(); + + @Override + DfKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/DfBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/DfBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..9b1490310e9d6f3547ba5e96b7556c91e4aa4210 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/DfBuilder.java @@ -0,0 +1,295 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.df.Qos; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link DfBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     DfBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new DfBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of DfBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see DfBuilder + * @see Builder + * + */ +public class DfBuilder implements Builder { + + private String _id; + private Qos _qos; + private Df.ServiceAvailabilityLevel _serviceAvailabilityLevel; + private DfKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public DfBuilder() { + } + + public DfBuilder(Df base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._qos = base.getQos(); + this._serviceAvailabilityLevel = base.getServiceAvailabilityLevel(); + } + + + public DfKey key() { + return key; + } + + public String getId() { + return _id; + } + + public Qos getQos() { + return _qos; + } + + public Df.ServiceAvailabilityLevel getServiceAvailabilityLevel() { + return _serviceAvailabilityLevel; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public DfBuilder withKey(final DfKey key) { + this.key = key; + return this; + } + + public DfBuilder setId(final String value) { + this._id = value; + return this; + } + + public DfBuilder setQos(final Qos value) { + this._qos = value; + return this; + } + + public DfBuilder setServiceAvailabilityLevel(final Df.ServiceAvailabilityLevel value) { + this._serviceAvailabilityLevel = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public DfBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public DfBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private DfBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Df build() { + return new DfImpl(this); + } + + private static final class DfImpl + extends AbstractAugmentable + implements Df { + + private final String _id; + private final Qos _qos; + private final Df.ServiceAvailabilityLevel _serviceAvailabilityLevel; + private final DfKey key; + + DfImpl(DfBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new DfKey(base.getId()); + } + this._id = key.getId(); + this._qos = base.getQos(); + this._serviceAvailabilityLevel = base.getServiceAvailabilityLevel(); + } + + @Override + public DfKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Qos getQos() { + return _qos; + } + + @Override + public Df.ServiceAvailabilityLevel getServiceAvailabilityLevel() { + return _serviceAvailabilityLevel; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_qos); + result = prime * result + Objects.hashCode(_serviceAvailabilityLevel); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Df.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Df other = (Df)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_qos, other.getQos())) { + return false; + } + if (!Objects.equals(_serviceAvailabilityLevel, other.getServiceAvailabilityLevel())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + DfImpl otherImpl = (DfImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Df"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_qos", _qos); + CodeHelpers.appendValue(helper, "_serviceAvailabilityLevel", _serviceAvailabilityLevel); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/DfKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/DfKey.java new file mode 100644 index 0000000000000000000000000000000000000000..79976472a71e32de760e786951bbeb10ca512eca --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/DfKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class DfKey + implements Identifier { + private static final long serialVersionUID = 4083286612161956839L; + private final String _id; + + + public DfKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public DfKey(DfKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DfKey)) { + return false; + } + final DfKey other = (DfKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(DfKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/df/Qos.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/df/Qos.java new file mode 100644 index 0000000000000000000000000000000000000000..04280a7d1cfd9ad65b0a891ab34edc9ccc4fce17 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/df/Qos.java @@ -0,0 +1,101 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.df; +import java.lang.Class; +import java.lang.Override; +import java.math.BigDecimal; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.Df; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * The QoS information element specifies quality of service parameters applicable + * to a VL. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container qos {
+ *   presence "VL QoS parameters";
+ *   leaf latency {
+ *     type uint32;
+ *     units ms;
+ *   }
+ *   leaf packet-delay-variation {
+ *     type uint32;
+ *     units ms;
+ *   }
+ *   leaf packet-loss-ratio {
+ *     type decimal64 {
+ *       fraction-digits 2;
+ *       range 0..1.00;
+ *     }
+ *   }
+ *   leaf priority {
+ *     type uint32;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/virtual-link-desc/df/qos + * + *

To create instances of this class use {@link QosBuilder}. + * @see QosBuilder + * + */ +public interface Qos + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("qos"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.df.Qos.class; + } + + /** + * Specifies the maximum latency in ms. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 latency, or null if not present + */ + @Nullable Uint32 getLatency(); + + /** + * Specifies the maximum jitter in ms. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 packetDelayVariation, or null if not present + */ + @Nullable Uint32 getPacketDelayVariation(); + + /** + * Specifies the maximum packet loss ratio. + * + * + * + * @return java.math.BigDecimal packetLossRatio, or null if not present + */ + @Nullable BigDecimal getPacketLossRatio(); + + /** + * Specifies the priority level in case of congestion on the underlying physical + * links. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 priority, or null if not present + */ + @Nullable Uint32 getPriority(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/df/QosBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/df/QosBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..af6d2e2a0064ca8983cb8af5eb4c085b2891e64a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/virtual/link/desc/df/QosBuilder.java @@ -0,0 +1,357 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.virtual.link.desc.df; +import com.google.common.base.MoreObjects; +import com.google.common.collect.Range; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.lang.reflect.Array; +import java.math.BigDecimal; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link QosBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     QosBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new QosBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of QosBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see QosBuilder + * @see Builder + * + */ +public class QosBuilder implements Builder { + + private Uint32 _latency; + private Uint32 _packetDelayVariation; + private BigDecimal _packetLossRatio; + private Uint32 _priority; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public QosBuilder() { + } + + public QosBuilder(Qos base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._latency = base.getLatency(); + this._packetDelayVariation = base.getPacketDelayVariation(); + this._packetLossRatio = base.getPacketLossRatio(); + this._priority = base.getPriority(); + } + + + public Uint32 getLatency() { + return _latency; + } + + public Uint32 getPacketDelayVariation() { + return _packetDelayVariation; + } + + public BigDecimal getPacketLossRatio() { + return _packetLossRatio; + } + + public Uint32 getPriority() { + return _priority; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public QosBuilder setLatency(final Uint32 value) { + this._latency = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLatency(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public QosBuilder setLatency(final Long value) { + return setLatency(CodeHelpers.compatUint(value)); + } + + public QosBuilder setPacketDelayVariation(final Uint32 value) { + this._packetDelayVariation = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setPacketDelayVariation(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public QosBuilder setPacketDelayVariation(final Long value) { + return setPacketDelayVariation(CodeHelpers.compatUint(value)); + } + + private static final Range[] CHECKPACKETLOSSRATIORANGE_RANGES; + static { + @SuppressWarnings("unchecked") + final Range[] a = (Range[]) Array.newInstance(Range.class, 1); + a[0] = Range.closed(java.math.BigDecimal.ZERO, new java.math.BigDecimal("1.00")); + CHECKPACKETLOSSRATIORANGE_RANGES = a; + } + private static void checkPacketLossRatioRange(final java.math.BigDecimal value) { + for (Range r : CHECKPACKETLOSSRATIORANGE_RANGES) { + if (r.contains(value)) { + return; + } + } + CodeHelpers.throwInvalidRange(CHECKPACKETLOSSRATIORANGE_RANGES, value); + } + + public QosBuilder setPacketLossRatio(final BigDecimal value) { + if (value != null) { + checkPacketLossRatioRange(value); + + } + this._packetLossRatio = value; + return this; + } + + public QosBuilder setPriority(final Uint32 value) { + this._priority = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setPriority(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public QosBuilder setPriority(final Long value) { + return setPriority(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public QosBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public QosBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public QosBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private QosBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Qos build() { + return new QosImpl(this); + } + + private static final class QosImpl + extends AbstractAugmentable + implements Qos { + + private final Uint32 _latency; + private final Uint32 _packetDelayVariation; + private final BigDecimal _packetLossRatio; + private final Uint32 _priority; + + QosImpl(QosBuilder base) { + super(base.augmentation); + this._latency = base.getLatency(); + this._packetDelayVariation = base.getPacketDelayVariation(); + this._packetLossRatio = base.getPacketLossRatio(); + this._priority = base.getPriority(); + } + + @Override + public Uint32 getLatency() { + return _latency; + } + + @Override + public Uint32 getPacketDelayVariation() { + return _packetDelayVariation; + } + + @Override + public BigDecimal getPacketLossRatio() { + return _packetLossRatio; + } + + @Override + public Uint32 getPriority() { + return _priority; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_latency); + result = prime * result + Objects.hashCode(_packetDelayVariation); + result = prime * result + Objects.hashCode(_packetLossRatio); + result = prime * result + Objects.hashCode(_priority); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Qos.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Qos other = (Qos)obj; + if (!Objects.equals(_latency, other.getLatency())) { + return false; + } + if (!Objects.equals(_packetDelayVariation, other.getPacketDelayVariation())) { + return false; + } + if (!Objects.equals(_packetLossRatio, other.getPacketLossRatio())) { + return false; + } + if (!Objects.equals(_priority, other.getPriority())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + QosImpl otherImpl = (QosImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Qos"); + CodeHelpers.appendValue(helper, "_latency", _latency); + CodeHelpers.appendValue(helper, "_packetDelayVariation", _packetDelayVariation); + CodeHelpers.appendValue(helper, "_packetLossRatio", _packetLossRatio); + CodeHelpers.appendValue(helper, "_priority", _priority); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/CpdPool.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/CpdPool.java new file mode 100644 index 0000000000000000000000000000000000000000..989a4103c701f8d5d206f5cd47a43add103688a5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/CpdPool.java @@ -0,0 +1,155 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Vnffgd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentBaseElementId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentCpdId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes a pool of descriptors of connection points attached to one of the + * constituent VNFs and PNFs and/or one of the SAPs of the parent NS or of a + * NS. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list cpd-pool {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   choice constituent-base-element-id {
+ *     case vnf-profile {
+ *       container vnf-profile {
+ *         leaf vnf-profile-id {
+ *           type leafref {
+ *             path ../../../../../nsd/df/vnf-profile/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     case pnf-profile {
+ *       container pnf-profile {
+ *         leaf pnf-profile-id {
+ *           type leafref {
+ *             path ../../../../../nsd/df/pnf-profile/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     case ns-profile {
+ *       container ns-profile {
+ *         leaf ns-profile-id {
+ *           type leafref {
+ *             path ../../../../../nsd/df/ns-profile/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ *   choice constituent-cpd-id {
+ *     case vnf {
+ *       container vnf {
+ *         leaf vnfd-id {
+ *           type leafref {
+ *             path ../../../../../vnfd/id;
+ *           }
+ *         }
+ *         leaf cpd-id {
+ *           type leafref {
+ *             path deref(../vnfd-id)/../ext-cpd/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     case pnf {
+ *       container pnf {
+ *         leaf pnfd-id {
+ *           type leafref {
+ *             path ../../../../../pnfd/id;
+ *           }
+ *         }
+ *         leaf pnf-cpd-id {
+ *           type leafref {
+ *             path deref(../pnfd-id)/../ext-cpd/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     case ns {
+ *       container ns {
+ *         leaf nsd-id {
+ *           type leafref {
+ *             path ../../../../../nsd/id;
+ *           }
+ *         }
+ *         leaf sap-cpd-id {
+ *           type leafref {
+ *             path deref(../nsd-id)/../sapd/id;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/cpd-pool + * + *

To create instances of this class use {@link CpdPoolBuilder}. + * @see CpdPoolBuilder + * @see CpdPoolKey + * + */ +public interface CpdPool + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("cpd-pool"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPool.class; + } + + /** + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Reference to the profile of an NS constituent. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentBaseElementId constituentBaseElementId, or null if not present + */ + @Nullable ConstituentBaseElementId getConstituentBaseElementId(); + + /** + * A reference to the descriptor of a connection point attached to one of the + * constituent VNFs and PNFs or to the descriptor of a NS SAP. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentCpdId constituentCpdId, or null if not present + */ + @Nullable ConstituentCpdId getConstituentCpdId(); + + @Override + CpdPoolKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/CpdPoolBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/CpdPoolBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..c4ab493b996926a35a6a82bfc3c22b94f9f05382 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/CpdPoolBuilder.java @@ -0,0 +1,296 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentBaseElementId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentCpdId; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link CpdPoolBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     CpdPoolBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new CpdPoolBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of CpdPoolBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see CpdPoolBuilder + * @see Builder + * + */ +public class CpdPoolBuilder implements Builder { + + private ConstituentBaseElementId _constituentBaseElementId; + private ConstituentCpdId _constituentCpdId; + private String _id; + private CpdPoolKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public CpdPoolBuilder() { + } + + public CpdPoolBuilder(CpdPool base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._constituentBaseElementId = base.getConstituentBaseElementId(); + this._constituentCpdId = base.getConstituentCpdId(); + } + + + public CpdPoolKey key() { + return key; + } + + public ConstituentBaseElementId getConstituentBaseElementId() { + return _constituentBaseElementId; + } + + public ConstituentCpdId getConstituentCpdId() { + return _constituentCpdId; + } + + public String getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public CpdPoolBuilder withKey(final CpdPoolKey key) { + this.key = key; + return this; + } + + public CpdPoolBuilder setConstituentBaseElementId(final ConstituentBaseElementId value) { + this._constituentBaseElementId = value; + return this; + } + + public CpdPoolBuilder setConstituentCpdId(final ConstituentCpdId value) { + this._constituentCpdId = value; + return this; + } + + public CpdPoolBuilder setId(final String value) { + this._id = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public CpdPoolBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public CpdPoolBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public CpdPoolBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private CpdPoolBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public CpdPool build() { + return new CpdPoolImpl(this); + } + + private static final class CpdPoolImpl + extends AbstractAugmentable + implements CpdPool { + + private final ConstituentBaseElementId _constituentBaseElementId; + private final ConstituentCpdId _constituentCpdId; + private final String _id; + private final CpdPoolKey key; + + CpdPoolImpl(CpdPoolBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new CpdPoolKey(base.getId()); + } + this._id = key.getId(); + this._constituentBaseElementId = base.getConstituentBaseElementId(); + this._constituentCpdId = base.getConstituentCpdId(); + } + + @Override + public CpdPoolKey key() { + return key; + } + + @Override + public ConstituentBaseElementId getConstituentBaseElementId() { + return _constituentBaseElementId; + } + + @Override + public ConstituentCpdId getConstituentCpdId() { + return _constituentCpdId; + } + + @Override + public String getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_constituentBaseElementId); + result = prime * result + Objects.hashCode(_constituentCpdId); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!CpdPool.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + CpdPool other = (CpdPool)obj; + if (!Objects.equals(_constituentBaseElementId, other.getConstituentBaseElementId())) { + return false; + } + if (!Objects.equals(_constituentCpdId, other.getConstituentCpdId())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + CpdPoolImpl otherImpl = (CpdPoolImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("CpdPool"); + CodeHelpers.appendValue(helper, "_constituentBaseElementId", _constituentBaseElementId); + CodeHelpers.appendValue(helper, "_constituentCpdId", _constituentCpdId); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/CpdPoolKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/CpdPoolKey.java new file mode 100644 index 0000000000000000000000000000000000000000..de095e3c062e8be15622ae1b758110decb93dedb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/CpdPoolKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class CpdPoolKey + implements Identifier { + private static final long serialVersionUID = 7881550034162738138L; + private final String _id; + + + public CpdPoolKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public CpdPoolKey(CpdPoolKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof CpdPoolKey)) { + return false; + } + final CpdPoolKey other = (CpdPoolKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(CpdPoolKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/Nfpd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/Nfpd.java new file mode 100644 index 0000000000000000000000000000000000000000..5f5793d9b0af94db9b87ce7db62ca357c4cbb3b2 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/Nfpd.java @@ -0,0 +1,124 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Vnffgd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.PositionDescId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.PositionDescIdKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The network forwarding path associated to the VNFFG. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list nfpd {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf rule {
+ *     type string;
+ *   }
+ *   list position-desc-id {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     list cp-profile-id {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       list constituent-profile-elements {
+ *         key id;
+ *         leaf id {
+ *           type string;
+ *         }
+ *         leaf cpd-id {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/nfpd + * + *

To create instances of this class use {@link NfpdBuilder}. + * @see NfpdBuilder + * @see NfpdKey + * + */ +public interface Nfpd + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("nfpd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.Nfpd.class; + } + + /** + * Identifies this nfpd information element within a VNFFGD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Provides an NFP classification and selection rule. The rule may be expressed as + * a criteria constructed out of atomic assertions linked by Boolean operators AND, + * OR and NOT. + * + * + * + * @return java.lang.String rule, or null if not present + */ + @Nullable String getRule(); + + /** + * Describes a position in the NFP in terms of one or more CP profiles and rules + * for distributing the traffic among CP and SAP instances created from the CPD or + * SAPD associated to these profiles. This shall be connection point profile, which + * is either a CPD associated with the VnfProfile of a constituent VNF, or a CPD + * associated with the PnfProfile of a constituent PNF, or a SAPD associated with + * the NsProfile of a nested NS. The related VnfProfile, PnfProfile and NsProfile + * shall be included in the parent VNFFGD. + * + * + * + * @return java.util.Map positionDescId, or null if not present + */ + @Nullable Map getPositionDescId(); + + /** + * @return java.util.Map positionDescId, or an empty list if it is not present + */ + default @NonNull Map nonnullPositionDescId() { + return CodeHelpers.nonnull(getPositionDescId()); + } + + @Override + NfpdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/NfpdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/NfpdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..b64b1275815df98f9651315323fc1efaf9daebae --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/NfpdBuilder.java @@ -0,0 +1,314 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.PositionDescId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.PositionDescIdKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NfpdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NfpdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NfpdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NfpdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NfpdBuilder + * @see Builder + * + */ +public class NfpdBuilder implements Builder { + + private String _id; + private Map _positionDescId; + private String _rule; + private NfpdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NfpdBuilder() { + } + + public NfpdBuilder(Nfpd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._positionDescId = base.getPositionDescId(); + this._rule = base.getRule(); + } + + + public NfpdKey key() { + return key; + } + + public String getId() { + return _id; + } + + public Map getPositionDescId() { + return _positionDescId; + } + + public String getRule() { + return _rule; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public NfpdBuilder withKey(final NfpdKey key) { + this.key = key; + return this; + } + + public NfpdBuilder setId(final String value) { + this._id = value; + return this; + } + public NfpdBuilder setPositionDescId(final Map values) { + this._positionDescId = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setPositionDescId(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NfpdBuilder setPositionDescId(final List values) { + return setPositionDescId(CodeHelpers.compatMap(values)); + } + + public NfpdBuilder setRule(final String value) { + this._rule = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NfpdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NfpdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NfpdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NfpdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Nfpd build() { + return new NfpdImpl(this); + } + + private static final class NfpdImpl + extends AbstractAugmentable + implements Nfpd { + + private final String _id; + private final Map _positionDescId; + private final String _rule; + private final NfpdKey key; + + NfpdImpl(NfpdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new NfpdKey(base.getId()); + } + this._id = key.getId(); + this._positionDescId = CodeHelpers.emptyToNull(base.getPositionDescId()); + this._rule = base.getRule(); + } + + @Override + public NfpdKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getPositionDescId() { + return _positionDescId; + } + + @Override + public String getRule() { + return _rule; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_positionDescId); + result = prime * result + Objects.hashCode(_rule); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Nfpd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Nfpd other = (Nfpd)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_positionDescId, other.getPositionDescId())) { + return false; + } + if (!Objects.equals(_rule, other.getRule())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NfpdImpl otherImpl = (NfpdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Nfpd"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_positionDescId", _positionDescId); + CodeHelpers.appendValue(helper, "_rule", _rule); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/NfpdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/NfpdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..becbeeea59ead4c02720319f881262b869209cfb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/NfpdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class NfpdKey + implements Identifier { + private static final long serialVersionUID = -6682064197064622726L; + private final String _id; + + + public NfpdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public NfpdKey(NfpdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof NfpdKey)) { + return false; + } + final NfpdKey other = (NfpdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(NfpdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/ConstituentBaseElementId.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/ConstituentBaseElementId.java new file mode 100644 index 0000000000000000000000000000000000000000..89d43f38304da079ab96e2eafdd13c6b07227a76 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/ConstituentBaseElementId.java @@ -0,0 +1,58 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPool; +import org.opendaylight.yangtools.yang.binding.ChoiceIn; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Reference to the profile of an NS constituent. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * choice constituent-base-element-id {
+ *   case vnf-profile {
+ *     container vnf-profile {
+ *       leaf vnf-profile-id {
+ *         type leafref {
+ *           path ../../../../../nsd/df/vnf-profile/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   case pnf-profile {
+ *     container pnf-profile {
+ *       leaf pnf-profile-id {
+ *         type leafref {
+ *           path ../../../../../nsd/df/pnf-profile/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   case ns-profile {
+ *     container ns-profile {
+ *       leaf ns-profile-id {
+ *         type leafref {
+ *           path ../../../../../nsd/df/ns-profile/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/cpd-pool/constituent-base-element-id + * + */ +public interface ConstituentBaseElementId + extends + ChoiceIn +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("constituent-base-element-id"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/ConstituentCpdId.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/ConstituentCpdId.java new file mode 100644 index 0000000000000000000000000000000000000000..83452c56b438557cfa54255e2d4d1ad61c452bb7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/ConstituentCpdId.java @@ -0,0 +1,74 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPool; +import org.opendaylight.yangtools.yang.binding.ChoiceIn; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * A reference to the descriptor of a connection point attached to one of the + * constituent VNFs and PNFs or to the descriptor of a NS SAP. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * choice constituent-cpd-id {
+ *   case vnf {
+ *     container vnf {
+ *       leaf vnfd-id {
+ *         type leafref {
+ *           path ../../../../../vnfd/id;
+ *         }
+ *       }
+ *       leaf cpd-id {
+ *         type leafref {
+ *           path deref(../vnfd-id)/../ext-cpd/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   case pnf {
+ *     container pnf {
+ *       leaf pnfd-id {
+ *         type leafref {
+ *           path ../../../../../pnfd/id;
+ *         }
+ *       }
+ *       leaf pnf-cpd-id {
+ *         type leafref {
+ *           path deref(../pnfd-id)/../ext-cpd/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   case ns {
+ *     container ns {
+ *       leaf nsd-id {
+ *         type leafref {
+ *           path ../../../../../nsd/id;
+ *         }
+ *       }
+ *       leaf sap-cpd-id {
+ *         type leafref {
+ *           path deref(../nsd-id)/../sapd/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/cpd-pool/constituent-cpd-id + * + */ +public interface ConstituentCpdId + extends + ChoiceIn +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("constituent-cpd-id"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/NsProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/NsProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..991accd746e4a70454ef2e7086281e22ef36fb92 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/NsProfile.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentBaseElementId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface NsProfile + extends + DataObject, + Augmentable, + ConstituentBaseElementId +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ns-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.NsProfile.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.ns.profile.NsProfile nsProfile, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.ns.profile.@Nullable NsProfile getNsProfile(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/NsProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/NsProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..46591610154bd08356d00ba7d6d1ab2ea2fdde9c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/NsProfileBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NsProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsProfileBuilder + * @see Builder + * + */ +public class NsProfileBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.ns.profile.NsProfile _nsProfile; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsProfileBuilder() { + } + + public NsProfileBuilder(NsProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._nsProfile = base.getNsProfile(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.ns.profile.NsProfile getNsProfile() { + return _nsProfile; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public NsProfileBuilder setNsProfile(final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.ns.profile.NsProfile value) { + this._nsProfile = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public NsProfile build() { + return new NsProfileImpl(this); + } + + private static final class NsProfileImpl + extends AbstractAugmentable + implements NsProfile { + + private final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.ns.profile.NsProfile _nsProfile; + + NsProfileImpl(NsProfileBuilder base) { + super(base.augmentation); + this._nsProfile = base.getNsProfile(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.ns.profile.NsProfile getNsProfile() { + return _nsProfile; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_nsProfile); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!NsProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + NsProfile other = (NsProfile)obj; + if (!Objects.equals(_nsProfile, other.getNsProfile())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsProfileImpl otherImpl = (NsProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("NsProfile"); + CodeHelpers.appendValue(helper, "_nsProfile", _nsProfile); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/PnfProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/PnfProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..5ef9e18aadbee35c2f75b9073bfc983511bd8d0f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/PnfProfile.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentBaseElementId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface PnfProfile + extends + DataObject, + Augmentable, + ConstituentBaseElementId +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pnf-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.PnfProfile.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.pnf.profile.PnfProfile pnfProfile, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.pnf.profile.@Nullable PnfProfile getPnfProfile(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/PnfProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/PnfProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..b0489ad1aa8e836484a4549913120893035a4dd3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/PnfProfileBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PnfProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PnfProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PnfProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PnfProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PnfProfileBuilder + * @see Builder + * + */ +public class PnfProfileBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.pnf.profile.PnfProfile _pnfProfile; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PnfProfileBuilder() { + } + + public PnfProfileBuilder(PnfProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._pnfProfile = base.getPnfProfile(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.pnf.profile.PnfProfile getPnfProfile() { + return _pnfProfile; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public PnfProfileBuilder setPnfProfile(final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.pnf.profile.PnfProfile value) { + this._pnfProfile = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PnfProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PnfProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PnfProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PnfProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public PnfProfile build() { + return new PnfProfileImpl(this); + } + + private static final class PnfProfileImpl + extends AbstractAugmentable + implements PnfProfile { + + private final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.pnf.profile.PnfProfile _pnfProfile; + + PnfProfileImpl(PnfProfileBuilder base) { + super(base.augmentation); + this._pnfProfile = base.getPnfProfile(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.pnf.profile.PnfProfile getPnfProfile() { + return _pnfProfile; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_pnfProfile); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!PnfProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + PnfProfile other = (PnfProfile)obj; + if (!Objects.equals(_pnfProfile, other.getPnfProfile())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PnfProfileImpl otherImpl = (PnfProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("PnfProfile"); + CodeHelpers.appendValue(helper, "_pnfProfile", _pnfProfile); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/VnfProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/VnfProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..e512537533ad114ee1113116468199322fb6af94 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/VnfProfile.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentBaseElementId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface VnfProfile + extends + DataObject, + Augmentable, + ConstituentBaseElementId +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnf-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.VnfProfile.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.vnf.profile.VnfProfile vnfProfile, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.vnf.profile.@Nullable VnfProfile getVnfProfile(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/VnfProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/VnfProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..f6816da6e51fc77fd667f194bc7ac45514a41edf --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/VnfProfileBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VnfProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfProfileBuilder + * @see Builder + * + */ +public class VnfProfileBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.vnf.profile.VnfProfile _vnfProfile; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfProfileBuilder() { + } + + public VnfProfileBuilder(VnfProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._vnfProfile = base.getVnfProfile(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.vnf.profile.VnfProfile getVnfProfile() { + return _vnfProfile; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VnfProfileBuilder setVnfProfile(final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.vnf.profile.VnfProfile value) { + this._vnfProfile = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VnfProfile build() { + return new VnfProfileImpl(this); + } + + private static final class VnfProfileImpl + extends AbstractAugmentable + implements VnfProfile { + + private final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.vnf.profile.VnfProfile _vnfProfile; + + VnfProfileImpl(VnfProfileBuilder base) { + super(base.augmentation); + this._vnfProfile = base.getVnfProfile(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.vnf.profile.VnfProfile getVnfProfile() { + return _vnfProfile; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_vnfProfile); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VnfProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VnfProfile other = (VnfProfile)obj; + if (!Objects.equals(_vnfProfile, other.getVnfProfile())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfProfileImpl otherImpl = (VnfProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VnfProfile"); + CodeHelpers.appendValue(helper, "_vnfProfile", _vnfProfile); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/ns/profile/NsProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/ns/profile/NsProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..163a537a0d2033ad755ecef02506b98b244882d6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/ns/profile/NsProfile.java @@ -0,0 +1,53 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.ns.profile; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPool; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container ns-profile {
+ *   leaf ns-profile-id {
+ *     type leafref {
+ *       path ../../../../../nsd/df/ns-profile/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/cpd-pool/constituent-base-element-id/ns-profile/ns-profile + * + *

To create instances of this class use {@link NsProfileBuilder}. + * @see NsProfileBuilder + * + */ +public interface NsProfile + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ns-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.ns.profile.NsProfile.class; + } + + /** + * @return java.lang.String nsProfileId, or null if not present + */ + @Nullable String getNsProfileId(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/ns/profile/NsProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/ns/profile/NsProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..edbac3f8c462e75936c57b270de0004ffe6f7a04 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/ns/profile/NsProfileBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.ns.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NsProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsProfileBuilder + * @see Builder + * + */ +public class NsProfileBuilder implements Builder { + + private String _nsProfileId; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsProfileBuilder() { + } + + public NsProfileBuilder(NsProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._nsProfileId = base.getNsProfileId(); + } + + + public String getNsProfileId() { + return _nsProfileId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public NsProfileBuilder setNsProfileId(final String value) { + this._nsProfileId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public NsProfile build() { + return new NsProfileImpl(this); + } + + private static final class NsProfileImpl + extends AbstractAugmentable + implements NsProfile { + + private final String _nsProfileId; + + NsProfileImpl(NsProfileBuilder base) { + super(base.augmentation); + this._nsProfileId = base.getNsProfileId(); + } + + @Override + public String getNsProfileId() { + return _nsProfileId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_nsProfileId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!NsProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + NsProfile other = (NsProfile)obj; + if (!Objects.equals(_nsProfileId, other.getNsProfileId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsProfileImpl otherImpl = (NsProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("NsProfile"); + CodeHelpers.appendValue(helper, "_nsProfileId", _nsProfileId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/pnf/profile/PnfProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/pnf/profile/PnfProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..34d343f964d7d4a10867920867c2b0f6426eeff4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/pnf/profile/PnfProfile.java @@ -0,0 +1,53 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.pnf.profile; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPool; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container pnf-profile {
+ *   leaf pnf-profile-id {
+ *     type leafref {
+ *       path ../../../../../nsd/df/pnf-profile/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/cpd-pool/constituent-base-element-id/pnf-profile/pnf-profile + * + *

To create instances of this class use {@link PnfProfileBuilder}. + * @see PnfProfileBuilder + * + */ +public interface PnfProfile + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pnf-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.pnf.profile.PnfProfile.class; + } + + /** + * @return java.lang.String pnfProfileId, or null if not present + */ + @Nullable String getPnfProfileId(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/pnf/profile/PnfProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/pnf/profile/PnfProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..9d78928f6bc5b423ab4ba1b07cee86819b05f40f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/pnf/profile/PnfProfileBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.pnf.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PnfProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PnfProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PnfProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PnfProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PnfProfileBuilder + * @see Builder + * + */ +public class PnfProfileBuilder implements Builder { + + private String _pnfProfileId; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PnfProfileBuilder() { + } + + public PnfProfileBuilder(PnfProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._pnfProfileId = base.getPnfProfileId(); + } + + + public String getPnfProfileId() { + return _pnfProfileId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public PnfProfileBuilder setPnfProfileId(final String value) { + this._pnfProfileId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PnfProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PnfProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PnfProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PnfProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public PnfProfile build() { + return new PnfProfileImpl(this); + } + + private static final class PnfProfileImpl + extends AbstractAugmentable + implements PnfProfile { + + private final String _pnfProfileId; + + PnfProfileImpl(PnfProfileBuilder base) { + super(base.augmentation); + this._pnfProfileId = base.getPnfProfileId(); + } + + @Override + public String getPnfProfileId() { + return _pnfProfileId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_pnfProfileId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!PnfProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + PnfProfile other = (PnfProfile)obj; + if (!Objects.equals(_pnfProfileId, other.getPnfProfileId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PnfProfileImpl otherImpl = (PnfProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("PnfProfile"); + CodeHelpers.appendValue(helper, "_pnfProfileId", _pnfProfileId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/vnf/profile/VnfProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/vnf/profile/VnfProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..5d18f5e3bf0882b3a5e895bdb869ddb8284636dd --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/vnf/profile/VnfProfile.java @@ -0,0 +1,53 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.vnf.profile; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPool; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container vnf-profile {
+ *   leaf vnf-profile-id {
+ *     type leafref {
+ *       path ../../../../../nsd/df/vnf-profile/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/cpd-pool/constituent-base-element-id/vnf-profile/vnf-profile + * + *

To create instances of this class use {@link VnfProfileBuilder}. + * @see VnfProfileBuilder + * + */ +public interface VnfProfile + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnf-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.vnf.profile.VnfProfile.class; + } + + /** + * @return java.lang.String vnfProfileId, or null if not present + */ + @Nullable String getVnfProfileId(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/vnf/profile/VnfProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/vnf/profile/VnfProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..5fd02c1b3bd89bab3607f816f8decf362ff7339a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/base/element/id/vnf/profile/VnfProfileBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.base.element.id.vnf.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VnfProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfProfileBuilder + * @see Builder + * + */ +public class VnfProfileBuilder implements Builder { + + private String _vnfProfileId; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfProfileBuilder() { + } + + public VnfProfileBuilder(VnfProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._vnfProfileId = base.getVnfProfileId(); + } + + + public String getVnfProfileId() { + return _vnfProfileId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VnfProfileBuilder setVnfProfileId(final String value) { + this._vnfProfileId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VnfProfile build() { + return new VnfProfileImpl(this); + } + + private static final class VnfProfileImpl + extends AbstractAugmentable + implements VnfProfile { + + private final String _vnfProfileId; + + VnfProfileImpl(VnfProfileBuilder base) { + super(base.augmentation); + this._vnfProfileId = base.getVnfProfileId(); + } + + @Override + public String getVnfProfileId() { + return _vnfProfileId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_vnfProfileId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VnfProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VnfProfile other = (VnfProfile)obj; + if (!Objects.equals(_vnfProfileId, other.getVnfProfileId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfProfileImpl otherImpl = (VnfProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VnfProfile"); + CodeHelpers.appendValue(helper, "_vnfProfileId", _vnfProfileId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/Ns.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/Ns.java new file mode 100644 index 0000000000000000000000000000000000000000..a44a02c72954131bf48351d1f1f2b5a58bface60 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/Ns.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentCpdId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface Ns + extends + DataObject, + Augmentable, + ConstituentCpdId +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ns"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.Ns.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.ns.Ns ns, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.ns.@Nullable Ns getNs(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/NsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/NsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..a748fcd688cc239d2361c7f0a9dbe31b1cafe152 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/NsBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsBuilder + * @see Builder + * + */ +public class NsBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.ns.Ns _ns; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsBuilder() { + } + + public NsBuilder(Ns base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._ns = base.getNs(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.ns.Ns getNs() { + return _ns; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public NsBuilder setNs(final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.ns.Ns value) { + this._ns = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Ns build() { + return new NsImpl(this); + } + + private static final class NsImpl + extends AbstractAugmentable + implements Ns { + + private final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.ns.Ns _ns; + + NsImpl(NsBuilder base) { + super(base.augmentation); + this._ns = base.getNs(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.ns.Ns getNs() { + return _ns; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_ns); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Ns.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Ns other = (Ns)obj; + if (!Objects.equals(_ns, other.getNs())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsImpl otherImpl = (NsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Ns"); + CodeHelpers.appendValue(helper, "_ns", _ns); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/Pnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/Pnf.java new file mode 100644 index 0000000000000000000000000000000000000000..5f4453d646ae42a8295ed53bd927b7c18056a279 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/Pnf.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentCpdId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface Pnf + extends + DataObject, + Augmentable, + ConstituentCpdId +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pnf"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.Pnf.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.pnf.Pnf pnf, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.pnf.@Nullable Pnf getPnf(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/PnfBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/PnfBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..bdcd91896743325f2445d62a145efb255682d205 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/PnfBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PnfBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PnfBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PnfBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PnfBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PnfBuilder + * @see Builder + * + */ +public class PnfBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.pnf.Pnf _pnf; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PnfBuilder() { + } + + public PnfBuilder(Pnf base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._pnf = base.getPnf(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.pnf.Pnf getPnf() { + return _pnf; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public PnfBuilder setPnf(final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.pnf.Pnf value) { + this._pnf = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PnfBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PnfBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PnfBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PnfBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Pnf build() { + return new PnfImpl(this); + } + + private static final class PnfImpl + extends AbstractAugmentable + implements Pnf { + + private final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.pnf.Pnf _pnf; + + PnfImpl(PnfBuilder base) { + super(base.augmentation); + this._pnf = base.getPnf(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.pnf.Pnf getPnf() { + return _pnf; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_pnf); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Pnf.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Pnf other = (Pnf)obj; + if (!Objects.equals(_pnf, other.getPnf())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PnfImpl otherImpl = (PnfImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Pnf"); + CodeHelpers.appendValue(helper, "_pnf", _pnf); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/Vnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/Vnf.java new file mode 100644 index 0000000000000000000000000000000000000000..92599979bfb66754e1902c1ba0dee55ca8d39a7d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/Vnf.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.ConstituentCpdId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface Vnf + extends + DataObject, + Augmentable, + ConstituentCpdId +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnf"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.Vnf.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.vnf.Vnf vnf, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.vnf.@Nullable Vnf getVnf(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/VnfBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/VnfBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..f554f1302818d0ddb54d16715f91d9a47dd7c45b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/VnfBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VnfBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfBuilder + * @see Builder + * + */ +public class VnfBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.vnf.Vnf _vnf; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfBuilder() { + } + + public VnfBuilder(Vnf base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._vnf = base.getVnf(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.vnf.Vnf getVnf() { + return _vnf; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VnfBuilder setVnf(final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.vnf.Vnf value) { + this._vnf = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Vnf build() { + return new VnfImpl(this); + } + + private static final class VnfImpl + extends AbstractAugmentable + implements Vnf { + + private final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.vnf.Vnf _vnf; + + VnfImpl(VnfBuilder base) { + super(base.augmentation); + this._vnf = base.getVnf(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.vnf.Vnf getVnf() { + return _vnf; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_vnf); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vnf.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vnf other = (Vnf)obj; + if (!Objects.equals(_vnf, other.getVnf())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfImpl otherImpl = (VnfImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vnf"); + CodeHelpers.appendValue(helper, "_vnf", _vnf); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/ns/Ns.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/ns/Ns.java new file mode 100644 index 0000000000000000000000000000000000000000..8026bd31ed5649b636dd3211dbe19f6f23525ae1 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/ns/Ns.java @@ -0,0 +1,63 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.ns; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPool; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container ns {
+ *   leaf nsd-id {
+ *     type leafref {
+ *       path ../../../../../nsd/id;
+ *     }
+ *   }
+ *   leaf sap-cpd-id {
+ *     type leafref {
+ *       path deref(../nsd-id)/../sapd/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/cpd-pool/constituent-cpd-id/ns/ns + * + *

To create instances of this class use {@link NsBuilder}. + * @see NsBuilder + * + */ +public interface Ns + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ns"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.ns.Ns.class; + } + + /** + * @return java.lang.String nsdId, or null if not present + */ + @Nullable String getNsdId(); + + /** + * @return java.lang.String sapCpdId, or null if not present + */ + @Nullable String getSapCpdId(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/ns/NsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/ns/NsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..8c8a6367d34f24b35930a015b366a8c428df12dd --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/ns/NsBuilder.java @@ -0,0 +1,250 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.ns; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsBuilder + * @see Builder + * + */ +public class NsBuilder implements Builder { + + private String _nsdId; + private String _sapCpdId; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsBuilder() { + } + + public NsBuilder(Ns base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._nsdId = base.getNsdId(); + this._sapCpdId = base.getSapCpdId(); + } + + + public String getNsdId() { + return _nsdId; + } + + public String getSapCpdId() { + return _sapCpdId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public NsBuilder setNsdId(final String value) { + this._nsdId = value; + return this; + } + + public NsBuilder setSapCpdId(final String value) { + this._sapCpdId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Ns build() { + return new NsImpl(this); + } + + private static final class NsImpl + extends AbstractAugmentable + implements Ns { + + private final String _nsdId; + private final String _sapCpdId; + + NsImpl(NsBuilder base) { + super(base.augmentation); + this._nsdId = base.getNsdId(); + this._sapCpdId = base.getSapCpdId(); + } + + @Override + public String getNsdId() { + return _nsdId; + } + + @Override + public String getSapCpdId() { + return _sapCpdId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_nsdId); + result = prime * result + Objects.hashCode(_sapCpdId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Ns.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Ns other = (Ns)obj; + if (!Objects.equals(_nsdId, other.getNsdId())) { + return false; + } + if (!Objects.equals(_sapCpdId, other.getSapCpdId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsImpl otherImpl = (NsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Ns"); + CodeHelpers.appendValue(helper, "_nsdId", _nsdId); + CodeHelpers.appendValue(helper, "_sapCpdId", _sapCpdId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/pnf/Pnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/pnf/Pnf.java new file mode 100644 index 0000000000000000000000000000000000000000..c5806d1ff68a8a62bc8b53dfbdf85af32d9cf861 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/pnf/Pnf.java @@ -0,0 +1,63 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.pnf; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPool; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container pnf {
+ *   leaf pnfd-id {
+ *     type leafref {
+ *       path ../../../../../pnfd/id;
+ *     }
+ *   }
+ *   leaf pnf-cpd-id {
+ *     type leafref {
+ *       path deref(../pnfd-id)/../ext-cpd/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/cpd-pool/constituent-cpd-id/pnf/pnf + * + *

To create instances of this class use {@link PnfBuilder}. + * @see PnfBuilder + * + */ +public interface Pnf + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pnf"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.pnf.Pnf.class; + } + + /** + * @return java.lang.String pnfdId, or null if not present + */ + @Nullable String getPnfdId(); + + /** + * @return java.lang.String pnfCpdId, or null if not present + */ + @Nullable String getPnfCpdId(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/pnf/PnfBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/pnf/PnfBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..7286eb2ff91230c58502c141d79ae58b04992e21 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/pnf/PnfBuilder.java @@ -0,0 +1,250 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.pnf; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PnfBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PnfBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PnfBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PnfBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PnfBuilder + * @see Builder + * + */ +public class PnfBuilder implements Builder { + + private String _pnfCpdId; + private String _pnfdId; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PnfBuilder() { + } + + public PnfBuilder(Pnf base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._pnfCpdId = base.getPnfCpdId(); + this._pnfdId = base.getPnfdId(); + } + + + public String getPnfCpdId() { + return _pnfCpdId; + } + + public String getPnfdId() { + return _pnfdId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public PnfBuilder setPnfCpdId(final String value) { + this._pnfCpdId = value; + return this; + } + + public PnfBuilder setPnfdId(final String value) { + this._pnfdId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PnfBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PnfBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PnfBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PnfBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Pnf build() { + return new PnfImpl(this); + } + + private static final class PnfImpl + extends AbstractAugmentable + implements Pnf { + + private final String _pnfCpdId; + private final String _pnfdId; + + PnfImpl(PnfBuilder base) { + super(base.augmentation); + this._pnfCpdId = base.getPnfCpdId(); + this._pnfdId = base.getPnfdId(); + } + + @Override + public String getPnfCpdId() { + return _pnfCpdId; + } + + @Override + public String getPnfdId() { + return _pnfdId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_pnfCpdId); + result = prime * result + Objects.hashCode(_pnfdId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Pnf.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Pnf other = (Pnf)obj; + if (!Objects.equals(_pnfCpdId, other.getPnfCpdId())) { + return false; + } + if (!Objects.equals(_pnfdId, other.getPnfdId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PnfImpl otherImpl = (PnfImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Pnf"); + CodeHelpers.appendValue(helper, "_pnfCpdId", _pnfCpdId); + CodeHelpers.appendValue(helper, "_pnfdId", _pnfdId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/vnf/Vnf.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/vnf/Vnf.java new file mode 100644 index 0000000000000000000000000000000000000000..b61bf6bc891c73a4b9b67513361e8ee18a7ebb95 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/vnf/Vnf.java @@ -0,0 +1,63 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.vnf; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.CpdPool; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container vnf {
+ *   leaf vnfd-id {
+ *     type leafref {
+ *       path ../../../../../vnfd/id;
+ *     }
+ *   }
+ *   leaf cpd-id {
+ *     type leafref {
+ *       path deref(../vnfd-id)/../ext-cpd/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/cpd-pool/constituent-cpd-id/vnf/vnf + * + *

To create instances of this class use {@link VnfBuilder}. + * @see VnfBuilder + * + */ +public interface Vnf + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnf"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.vnf.Vnf.class; + } + + /** + * @return java.lang.String vnfdId, or null if not present + */ + @Nullable String getVnfdId(); + + /** + * @return java.lang.String cpdId, or null if not present + */ + @Nullable String getCpdId(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/vnf/VnfBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/vnf/VnfBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..698f07e6010a1d3f869e7b162d1437331ee90304 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/cpd/pool/constituent/cpd/id/vnf/VnfBuilder.java @@ -0,0 +1,250 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.cpd.pool.constituent.cpd.id.vnf; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VnfBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfBuilder + * @see Builder + * + */ +public class VnfBuilder implements Builder { + + private String _cpdId; + private String _vnfdId; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfBuilder() { + } + + public VnfBuilder(Vnf base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._cpdId = base.getCpdId(); + this._vnfdId = base.getVnfdId(); + } + + + public String getCpdId() { + return _cpdId; + } + + public String getVnfdId() { + return _vnfdId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VnfBuilder setCpdId(final String value) { + this._cpdId = value; + return this; + } + + public VnfBuilder setVnfdId(final String value) { + this._vnfdId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Vnf build() { + return new VnfImpl(this); + } + + private static final class VnfImpl + extends AbstractAugmentable + implements Vnf { + + private final String _cpdId; + private final String _vnfdId; + + VnfImpl(VnfBuilder base) { + super(base.augmentation); + this._cpdId = base.getCpdId(); + this._vnfdId = base.getVnfdId(); + } + + @Override + public String getCpdId() { + return _cpdId; + } + + @Override + public String getVnfdId() { + return _vnfdId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cpdId); + result = prime * result + Objects.hashCode(_vnfdId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vnf.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vnf other = (Vnf)obj; + if (!Objects.equals(_cpdId, other.getCpdId())) { + return false; + } + if (!Objects.equals(_vnfdId, other.getVnfdId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfImpl otherImpl = (VnfImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vnf"); + CodeHelpers.appendValue(helper, "_cpdId", _cpdId); + CodeHelpers.appendValue(helper, "_vnfdId", _vnfdId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/PositionDescId.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/PositionDescId.java new file mode 100644 index 0000000000000000000000000000000000000000..c5a6aa7ed58eca75da7c8918a68f8dedfe927be7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/PositionDescId.java @@ -0,0 +1,107 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.Nfpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.CpProfileId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.CpProfileIdKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes a position in the NFP in terms of one or more CP profiles and rules + * for distributing the traffic among CP and SAP instances created from the CPD or + * SAPD associated to these profiles. This shall be connection point profile, + * is either a CPD associated with the VnfProfile of a constituent VNF, or a CPD + * associated with the PnfProfile of a constituent PNF, or a SAPD associated with + * the NsProfile of a nested NS. The related VnfProfile, PnfProfile and NsProfile + * shall be included in the parent VNFFGD. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list position-desc-id {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   list cp-profile-id {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     list constituent-profile-elements {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf cpd-id {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/nfpd/position-desc-id + * + *

To create instances of this class use {@link PositionDescIdBuilder}. + * @see PositionDescIdBuilder + * @see PositionDescIdKey + * + */ +public interface PositionDescId + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("position-desc-id"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.PositionDescId.class; + } + + /** + * Identifier of this NfpPositionDesc element. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * References the profile of a connection point to be traversed by the traffic + * flows matching the criteria. This shall be a connection point attached to one of + * the constituent VNFs and PNFs of the parent VNFFG, or a SAP of one of the + * constituent nested NSs of the parent VNFFG. + * + * + * + * @return java.util.Map cpProfileId, or null if not present + */ + @Nullable Map getCpProfileId(); + + /** + * @return java.util.Map cpProfileId, or an empty list if it is not present + */ + default @NonNull Map nonnullCpProfileId() { + return CodeHelpers.nonnull(getCpProfileId()); + } + + @Override + PositionDescIdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/PositionDescIdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/PositionDescIdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..090706101967648b9a4ba076297f6e7dca91b174 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/PositionDescIdBuilder.java @@ -0,0 +1,291 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.CpProfileId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.CpProfileIdKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PositionDescIdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PositionDescIdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PositionDescIdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PositionDescIdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PositionDescIdBuilder + * @see Builder + * + */ +public class PositionDescIdBuilder implements Builder { + + private Map _cpProfileId; + private String _id; + private PositionDescIdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PositionDescIdBuilder() { + } + + public PositionDescIdBuilder(PositionDescId base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._cpProfileId = base.getCpProfileId(); + } + + + public PositionDescIdKey key() { + return key; + } + + public Map getCpProfileId() { + return _cpProfileId; + } + + public String getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public PositionDescIdBuilder withKey(final PositionDescIdKey key) { + this.key = key; + return this; + } + public PositionDescIdBuilder setCpProfileId(final Map values) { + this._cpProfileId = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setCpProfileId(Map)} instead. + */ + @Deprecated(forRemoval = true) + public PositionDescIdBuilder setCpProfileId(final List values) { + return setCpProfileId(CodeHelpers.compatMap(values)); + } + + public PositionDescIdBuilder setId(final String value) { + this._id = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PositionDescIdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PositionDescIdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PositionDescIdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PositionDescIdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public PositionDescId build() { + return new PositionDescIdImpl(this); + } + + private static final class PositionDescIdImpl + extends AbstractAugmentable + implements PositionDescId { + + private final Map _cpProfileId; + private final String _id; + private final PositionDescIdKey key; + + PositionDescIdImpl(PositionDescIdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new PositionDescIdKey(base.getId()); + } + this._id = key.getId(); + this._cpProfileId = CodeHelpers.emptyToNull(base.getCpProfileId()); + } + + @Override + public PositionDescIdKey key() { + return key; + } + + @Override + public Map getCpProfileId() { + return _cpProfileId; + } + + @Override + public String getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cpProfileId); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!PositionDescId.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + PositionDescId other = (PositionDescId)obj; + if (!Objects.equals(_cpProfileId, other.getCpProfileId())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PositionDescIdImpl otherImpl = (PositionDescIdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("PositionDescId"); + CodeHelpers.appendValue(helper, "_cpProfileId", _cpProfileId); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/PositionDescIdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/PositionDescIdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..35197914cd4884769678d5d08857997a46b8629d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/PositionDescIdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class PositionDescIdKey + implements Identifier { + private static final long serialVersionUID = 4821410304072817872L; + private final String _id; + + + public PositionDescIdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public PositionDescIdKey(PositionDescIdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof PositionDescIdKey)) { + return false; + } + final PositionDescIdKey other = (PositionDescIdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(PositionDescIdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/CpProfileId.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/CpProfileId.java new file mode 100644 index 0000000000000000000000000000000000000000..a9bd343f670d8ffd5cf611ea5e790904dada167e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/CpProfileId.java @@ -0,0 +1,96 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.PositionDescId; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.cp.profile.id.ConstituentProfileElements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.cp.profile.id.ConstituentProfileElementsKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * References the profile of a connection point to be traversed by the traffic + * flows matching the criteria. This shall be a connection point attached to one + * the constituent VNFs and PNFs of the parent VNFFG, or a SAP of one of the + * constituent nested NSs of the parent VNFFG. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list cp-profile-id {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   list constituent-profile-elements {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf cpd-id {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/nfpd/position-desc-id/cp-profile-id + * + *

To create instances of this class use {@link CpProfileIdBuilder}. + * @see CpProfileIdBuilder + * @see CpProfileIdKey + * + */ +public interface CpProfileId + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("cp-profile-id"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.CpProfileId.class; + } + + /** + * Identifier of this CpProfile information element. It uniquely identifies a + * CpProfile. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Specifies the constituents of the CpProfile. + * + * + * + * @return java.util.Map constituentProfileElements, or null if not present + */ + @Nullable Map getConstituentProfileElements(); + + /** + * @return java.util.Map constituentProfileElements, or an empty list if it is not present + */ + default @NonNull Map nonnullConstituentProfileElements() { + return CodeHelpers.nonnull(getConstituentProfileElements()); + } + + @Override + CpProfileIdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/CpProfileIdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/CpProfileIdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..0ea14d7b8012e28bf72c49ef1bfd843b65bb54ca --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/CpProfileIdBuilder.java @@ -0,0 +1,291 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.cp.profile.id.ConstituentProfileElements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.cp.profile.id.ConstituentProfileElementsKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link CpProfileIdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     CpProfileIdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new CpProfileIdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of CpProfileIdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see CpProfileIdBuilder + * @see Builder + * + */ +public class CpProfileIdBuilder implements Builder { + + private Map _constituentProfileElements; + private String _id; + private CpProfileIdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public CpProfileIdBuilder() { + } + + public CpProfileIdBuilder(CpProfileId base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._constituentProfileElements = base.getConstituentProfileElements(); + } + + + public CpProfileIdKey key() { + return key; + } + + public Map getConstituentProfileElements() { + return _constituentProfileElements; + } + + public String getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public CpProfileIdBuilder withKey(final CpProfileIdKey key) { + this.key = key; + return this; + } + public CpProfileIdBuilder setConstituentProfileElements(final Map values) { + this._constituentProfileElements = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setConstituentProfileElements(Map)} instead. + */ + @Deprecated(forRemoval = true) + public CpProfileIdBuilder setConstituentProfileElements(final List values) { + return setConstituentProfileElements(CodeHelpers.compatMap(values)); + } + + public CpProfileIdBuilder setId(final String value) { + this._id = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public CpProfileIdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public CpProfileIdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public CpProfileIdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private CpProfileIdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public CpProfileId build() { + return new CpProfileIdImpl(this); + } + + private static final class CpProfileIdImpl + extends AbstractAugmentable + implements CpProfileId { + + private final Map _constituentProfileElements; + private final String _id; + private final CpProfileIdKey key; + + CpProfileIdImpl(CpProfileIdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new CpProfileIdKey(base.getId()); + } + this._id = key.getId(); + this._constituentProfileElements = CodeHelpers.emptyToNull(base.getConstituentProfileElements()); + } + + @Override + public CpProfileIdKey key() { + return key; + } + + @Override + public Map getConstituentProfileElements() { + return _constituentProfileElements; + } + + @Override + public String getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_constituentProfileElements); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!CpProfileId.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + CpProfileId other = (CpProfileId)obj; + if (!Objects.equals(_constituentProfileElements, other.getConstituentProfileElements())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + CpProfileIdImpl otherImpl = (CpProfileIdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("CpProfileId"); + CodeHelpers.appendValue(helper, "_constituentProfileElements", _constituentProfileElements); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/CpProfileIdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/CpProfileIdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..043b67bd8c335a07487c4e34e3d46c292722ff03 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/CpProfileIdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class CpProfileIdKey + implements Identifier { + private static final long serialVersionUID = 105739188582255767L; + private final String _id; + + + public CpProfileIdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public CpProfileIdKey(CpProfileIdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof CpProfileIdKey)) { + return false; + } + final CpProfileIdKey other = (CpProfileIdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(CpProfileIdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/cp/profile/id/ConstituentProfileElements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/cp/profile/id/ConstituentProfileElements.java new file mode 100644 index 0000000000000000000000000000000000000000..c4568893d5407db5cd815f0d113bb26889a505b6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/cp/profile/id/ConstituentProfileElements.java @@ -0,0 +1,77 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.cp.profile.id; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.CpProfileId; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies the constituents of the CpProfile. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list constituent-profile-elements {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf cpd-id {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/nsd/vnffgd/nfpd/position-desc-id/cp-profile-id/constituent-profile-elements + * + *

To create instances of this class use {@link ConstituentProfileElementsBuilder}. + * @see ConstituentProfileElementsBuilder + * @see ConstituentProfileElementsKey + * + */ +public interface ConstituentProfileElements + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("constituent-profile-elements"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.cp.profile.id.ConstituentProfileElements.class; + } + + /** + * Specifies the constituents of the CpProfile. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * References the VNF external CPD for a given VnfProfile, or the PNF external CPD + * for a given PnfProfile, or a NS SAPD for a give NsProfile identified by the + * constituentBasedElementId. + * + * + * + * @return java.lang.String cpdId, or null if not present + */ + @Nullable String getCpdId(); + + @Override + ConstituentProfileElementsKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/cp/profile/id/ConstituentProfileElementsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/cp/profile/id/ConstituentProfileElementsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..c96eee0c7daa8561fb6e8202eb80836d12b8c099 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/cp/profile/id/ConstituentProfileElementsBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.cp.profile.id; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ConstituentProfileElementsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ConstituentProfileElementsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ConstituentProfileElementsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ConstituentProfileElementsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ConstituentProfileElementsBuilder + * @see Builder + * + */ +public class ConstituentProfileElementsBuilder implements Builder { + + private String _cpdId; + private String _id; + private ConstituentProfileElementsKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ConstituentProfileElementsBuilder() { + } + + public ConstituentProfileElementsBuilder(ConstituentProfileElements base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._cpdId = base.getCpdId(); + } + + + public ConstituentProfileElementsKey key() { + return key; + } + + public String getCpdId() { + return _cpdId; + } + + public String getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ConstituentProfileElementsBuilder withKey(final ConstituentProfileElementsKey key) { + this.key = key; + return this; + } + + public ConstituentProfileElementsBuilder setCpdId(final String value) { + this._cpdId = value; + return this; + } + + public ConstituentProfileElementsBuilder setId(final String value) { + this._id = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ConstituentProfileElementsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ConstituentProfileElementsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ConstituentProfileElementsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ConstituentProfileElementsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ConstituentProfileElements build() { + return new ConstituentProfileElementsImpl(this); + } + + private static final class ConstituentProfileElementsImpl + extends AbstractAugmentable + implements ConstituentProfileElements { + + private final String _cpdId; + private final String _id; + private final ConstituentProfileElementsKey key; + + ConstituentProfileElementsImpl(ConstituentProfileElementsBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ConstituentProfileElementsKey(base.getId()); + } + this._id = key.getId(); + this._cpdId = base.getCpdId(); + } + + @Override + public ConstituentProfileElementsKey key() { + return key; + } + + @Override + public String getCpdId() { + return _cpdId; + } + + @Override + public String getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cpdId); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ConstituentProfileElements.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ConstituentProfileElements other = (ConstituentProfileElements)obj; + if (!Objects.equals(_cpdId, other.getCpdId())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ConstituentProfileElementsImpl otherImpl = (ConstituentProfileElementsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ConstituentProfileElements"); + CodeHelpers.appendValue(helper, "_cpdId", _cpdId); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/cp/profile/id/ConstituentProfileElementsKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/cp/profile/id/ConstituentProfileElementsKey.java new file mode 100644 index 0000000000000000000000000000000000000000..788e6b0eb2bdd86b86d9154931b56745cfd83363 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/nsd/vnffgd/nfpd/position/desc/id/cp/profile/id/ConstituentProfileElementsKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.vnffgd.nfpd.position.desc.id.cp.profile.id; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ConstituentProfileElementsKey + implements Identifier { + private static final long serialVersionUID = 6080693131906435044L; + private final String _id; + + + public ConstituentProfileElementsKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ConstituentProfileElementsKey(ConstituentProfileElementsKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ConstituentProfileElementsKey)) { + return false; + } + final ConstituentProfileElementsKey other = (ConstituentProfileElementsKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ConstituentProfileElementsKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/ExtCpd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/ExtCpd.java new file mode 100644 index 0000000000000000000000000000000000000000..41b60be01d072dcc92b8ce4bbefbc3fc98ae6c47 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/ExtCpd.java @@ -0,0 +1,53 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies the characteristics of one or more connection points where to connect + * the PNF to a VL. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list ext-cpd {
+ *   key id;
+ *   uses cpd;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/pnfd/ext-cpd + * + *

To create instances of this class use {@link ExtCpdBuilder}. + * @see ExtCpdBuilder + * @see ExtCpdKey + * + */ +public interface ExtCpd + extends + ChildOf, + Augmentable, + Cpd, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ext-cpd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.ExtCpd.class; + } + + @Override + ExtCpdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/ExtCpdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/ExtCpdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..fb9aa843e5e6c16a620c11ec76118035b7d878d3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/ExtCpdBuilder.java @@ -0,0 +1,416 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.CpRole; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.Protocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.ProtocolKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ExtCpdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ExtCpdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ExtCpdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ExtCpdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ExtCpdBuilder + * @see Builder + * + */ +public class ExtCpdBuilder implements Builder { + + private String _description; + private String _id; + private List> _layerProtocol; + private Map _protocol; + private Class _role; + private Boolean _trunkMode; + private ExtCpdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ExtCpdBuilder() { + } + public ExtCpdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd arg) { + this._id = arg.getId(); + this._layerProtocol = arg.getLayerProtocol(); + this._role = arg.getRole(); + this._description = arg.getDescription(); + this._protocol = arg.getProtocol(); + this._trunkMode = arg.isTrunkMode(); + } + + public ExtCpdBuilder(ExtCpd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._description = base.getDescription(); + this._layerProtocol = base.getLayerProtocol(); + this._protocol = base.getProtocol(); + this._role = base.getRole(); + this._trunkMode = base.isTrunkMode(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd) { + this._id = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getId(); + this._layerProtocol = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getLayerProtocol(); + this._role = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getRole(); + this._description = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getDescription(); + this._protocol = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getProtocol(); + this._trunkMode = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).isTrunkMode(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd]"); + } + + public ExtCpdKey key() { + return key; + } + + public String getDescription() { + return _description; + } + + public String getId() { + return _id; + } + + public List> getLayerProtocol() { + return _layerProtocol; + } + + public Map getProtocol() { + return _protocol; + } + + public Class getRole() { + return _role; + } + + public Boolean isTrunkMode() { + return _trunkMode; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ExtCpdBuilder withKey(final ExtCpdKey key) { + this.key = key; + return this; + } + + public ExtCpdBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public ExtCpdBuilder setId(final String value) { + this._id = value; + return this; + } + public ExtCpdBuilder setLayerProtocol(final List> values) { + this._layerProtocol = values; + return this; + } + + public ExtCpdBuilder setProtocol(final Map values) { + this._protocol = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setProtocol(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ExtCpdBuilder setProtocol(final List values) { + return setProtocol(CodeHelpers.compatMap(values)); + } + + public ExtCpdBuilder setRole(final Class value) { + this._role = value; + return this; + } + + public ExtCpdBuilder setTrunkMode(final Boolean value) { + this._trunkMode = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ExtCpdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ExtCpdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ExtCpdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ExtCpdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ExtCpd build() { + return new ExtCpdImpl(this); + } + + private static final class ExtCpdImpl + extends AbstractAugmentable + implements ExtCpd { + + private final String _description; + private final String _id; + private final List> _layerProtocol; + private final Map _protocol; + private final Class _role; + private final Boolean _trunkMode; + private final ExtCpdKey key; + + ExtCpdImpl(ExtCpdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ExtCpdKey(base.getId()); + } + this._id = key.getId(); + this._description = base.getDescription(); + this._layerProtocol = base.getLayerProtocol(); + this._protocol = CodeHelpers.emptyToNull(base.getProtocol()); + this._role = base.getRole(); + this._trunkMode = base.isTrunkMode(); + } + + @Override + public ExtCpdKey key() { + return key; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public String getId() { + return _id; + } + + @Override + public List> getLayerProtocol() { + return _layerProtocol; + } + + @Override + public Map getProtocol() { + return _protocol; + } + + @Override + public Class getRole() { + return _role; + } + + @Override + public Boolean isTrunkMode() { + return _trunkMode; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_layerProtocol); + result = prime * result + Objects.hashCode(_protocol); + result = prime * result + Objects.hashCode(_role); + result = prime * result + Objects.hashCode(_trunkMode); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ExtCpd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ExtCpd other = (ExtCpd)obj; + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_layerProtocol, other.getLayerProtocol())) { + return false; + } + if (!Objects.equals(_protocol, other.getProtocol())) { + return false; + } + if (!Objects.equals(_role, other.getRole())) { + return false; + } + if (!Objects.equals(_trunkMode, other.isTrunkMode())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ExtCpdImpl otherImpl = (ExtCpdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ExtCpd"); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_layerProtocol", _layerProtocol); + CodeHelpers.appendValue(helper, "_protocol", _protocol); + CodeHelpers.appendValue(helper, "_role", _role); + CodeHelpers.appendValue(helper, "_trunkMode", _trunkMode); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/ExtCpdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/ExtCpdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..7f55a006f273fbafb61838c79f7b5f8c34432ce2 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/ExtCpdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ExtCpdKey + implements Identifier { + private static final long serialVersionUID = -7160822752734312733L; + private final String _id; + + + public ExtCpdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ExtCpdKey(ExtCpdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ExtCpdKey)) { + return false; + } + final ExtCpdKey other = (ExtCpdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ExtCpdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/Security.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/Security.java new file mode 100644 index 0000000000000000000000000000000000000000..0b132ba3799de78e7c4e33386b153bf6fed89e14 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/Security.java @@ -0,0 +1,54 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Provides a signature to prevent tampering. Editor's Note: While IFA014 does + * specify that the PNFD includes a security parameter. SOL001 does not have one. + * We need to harmonize SOL001 & SOL006 on this point. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list security {
+ *   key signature;
+ *   uses security-parameters;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/pnfd/security + * + *

To create instances of this class use {@link SecurityBuilder}. + * @see SecurityBuilder + * @see SecurityKey + * + */ +public interface Security + extends + ChildOf, + Augmentable, + SecurityParameters, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("security"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.Security.class; + } + + @Override + SecurityKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/SecurityBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/SecurityBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..3cde341151558aa439d77599728061999a465eb8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/SecurityBuilder.java @@ -0,0 +1,318 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link SecurityBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     SecurityBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new SecurityBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of SecurityBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see SecurityBuilder + * @see Builder + * + */ +public class SecurityBuilder implements Builder { + + private String _algorithm; + private String _certificate; + private String _signature; + private SecurityKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public SecurityBuilder() { + } + public SecurityBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters arg) { + this._signature = arg.getSignature(); + this._algorithm = arg.getAlgorithm(); + this._certificate = arg.getCertificate(); + } + + public SecurityBuilder(Security base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._signature = base.getSignature(); + this._algorithm = base.getAlgorithm(); + this._certificate = base.getCertificate(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters) { + this._signature = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getSignature(); + this._algorithm = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getAlgorithm(); + this._certificate = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getCertificate(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters]"); + } + + public SecurityKey key() { + return key; + } + + public String getAlgorithm() { + return _algorithm; + } + + public String getCertificate() { + return _certificate; + } + + public String getSignature() { + return _signature; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public SecurityBuilder withKey(final SecurityKey key) { + this.key = key; + return this; + } + + public SecurityBuilder setAlgorithm(final String value) { + this._algorithm = value; + return this; + } + + public SecurityBuilder setCertificate(final String value) { + this._certificate = value; + return this; + } + + public SecurityBuilder setSignature(final String value) { + this._signature = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public SecurityBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public SecurityBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public SecurityBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private SecurityBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Security build() { + return new SecurityImpl(this); + } + + private static final class SecurityImpl + extends AbstractAugmentable + implements Security { + + private final String _algorithm; + private final String _certificate; + private final String _signature; + private final SecurityKey key; + + SecurityImpl(SecurityBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new SecurityKey(base.getSignature()); + } + this._signature = key.getSignature(); + this._algorithm = base.getAlgorithm(); + this._certificate = base.getCertificate(); + } + + @Override + public SecurityKey key() { + return key; + } + + @Override + public String getAlgorithm() { + return _algorithm; + } + + @Override + public String getCertificate() { + return _certificate; + } + + @Override + public String getSignature() { + return _signature; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_algorithm); + result = prime * result + Objects.hashCode(_certificate); + result = prime * result + Objects.hashCode(_signature); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Security.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Security other = (Security)obj; + if (!Objects.equals(_algorithm, other.getAlgorithm())) { + return false; + } + if (!Objects.equals(_certificate, other.getCertificate())) { + return false; + } + if (!Objects.equals(_signature, other.getSignature())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + SecurityImpl otherImpl = (SecurityImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Security"); + CodeHelpers.appendValue(helper, "_algorithm", _algorithm); + CodeHelpers.appendValue(helper, "_certificate", _certificate); + CodeHelpers.appendValue(helper, "_signature", _signature); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/SecurityKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/SecurityKey.java new file mode 100644 index 0000000000000000000000000000000000000000..6a6abe3a0116efa15608a845077b88fe2156285b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/pnfd/SecurityKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class SecurityKey + implements Identifier { + private static final long serialVersionUID = -4666693731352198522L; + private final String _signature; + + + public SecurityKey(String _signature) { + + this._signature = _signature; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public SecurityKey(SecurityKey source) { + this._signature = source._signature; + } + + + public String getSignature() { + return _signature; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_signature); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof SecurityKey)) { + return false; + } + final SecurityKey other = (SecurityKey) obj; + if (!Objects.equals(_signature, other._signature)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(SecurityKey.class); + CodeHelpers.appendValue(helper, "_signature", _signature); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/security/group/rule/SecurityGroupRule.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/security/group/rule/SecurityGroupRule.java new file mode 100644 index 0000000000000000000000000000000000000000..e910e9e273675f141124d287ba6893c9e08c6a84 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/security/group/rule/SecurityGroupRule.java @@ -0,0 +1,349 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Defines security group rules to be used by the VNF. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list security-group-rule {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   leaf direction {
+ *     type enumeration {
+ *       enum ingress;
+ *       enum egress;
+ *     }
+ *     default ingress;
+ *   }
+ *   leaf ether-type {
+ *     type enumeration {
+ *       enum ipv4;
+ *       enum ipv6;
+ *     }
+ *     default ipv4;
+ *   }
+ *   leaf protocol {
+ *     type enumeration {
+ *       enum tcp;
+ *       enum udp;
+ *       enum icmp;
+ *     }
+ *     default tcp;
+ *   }
+ *   leaf port-range-min {
+ *     must ". <= ../port-range-max";
+ *     type uint16;
+ *     default 0;
+ *   }
+ *   leaf port-range-max {
+ *     must ". >= ../port-range-min";
+ *     type uint16;
+ *     default 65535;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/security-group-rule/security-group-rule + * + *

To create instances of this class use {@link SecurityGroupRuleBuilder}. + * @see SecurityGroupRuleBuilder + * @see SecurityGroupRuleKey + * + */ +public interface SecurityGroupRule + extends + ChildOf, + Augmentable, + Identifiable +{ + + + public enum Direction implements Enumeration { + Ingress(0, "ingress"), + + Egress(1, "egress") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (Direction enumItem : Direction.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private Direction(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding Direction item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding Direction item, or null if no such item exists + */ + public static Direction forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public enum EtherType implements Enumeration { + Ipv4(0, "ipv4"), + + Ipv6(1, "ipv6") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (EtherType enumItem : EtherType.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private EtherType(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding EtherType item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding EtherType item, or null if no such item exists + */ + public static EtherType forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public enum Protocol implements Enumeration { + Tcp(0, "tcp"), + + Udp(1, "udp"), + + Icmp(2, "icmp") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (Protocol enumItem : Protocol.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private Protocol(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding Protocol item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding Protocol item, or null if no such item exists + */ + public static Protocol forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("security-group-rule"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRule.class; + } + + /** + * Identifier of this SecurityGroupRule information element. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Human readable description of the security group rule. + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * The direction in which the security group rule is applied. Permitted values: + * INGRESS, EGRESS. Defaults to INGRESS. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRule.Direction direction, or null if not present + */ + @Nullable Direction getDirection(); + + /** + * Indicates the protocol carried over the Ethernet layer. Permitted values: IPV4, + * IPV6. Defaults to IPV4. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRule.EtherType etherType, or null if not present + */ + @Nullable EtherType getEtherType(); + + /** + * Indicates the protocol carried over the IP layer. Permitted values: any protocol + * defined in the IANA protocol registry, e.g. TCP, UDP, ICMP, etc. Defaults to + * TCP. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRule.Protocol protocol, or null if not present + */ + @Nullable Protocol getProtocol(); + + /** + * Indicates minimum port number in the range that is matched by the security group + * rule. Defaults to 0. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 portRangeMin, or null if not present + */ + @Nullable Uint16 getPortRangeMin(); + + /** + * Indicates maximum port number in the range that is matched by the security group + * rule. Defaults to 65535. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 portRangeMax, or null if not present + */ + @Nullable Uint16 getPortRangeMax(); + + @Override + SecurityGroupRuleKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/security/group/rule/SecurityGroupRuleBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/security/group/rule/SecurityGroupRuleBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..e039327438cd3e77eb1c54508f7375cc559689d7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/security/group/rule/SecurityGroupRuleBuilder.java @@ -0,0 +1,412 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Integer; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Class that builds {@link SecurityGroupRuleBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     SecurityGroupRuleBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new SecurityGroupRuleBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of SecurityGroupRuleBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see SecurityGroupRuleBuilder + * @see Builder + * + */ +public class SecurityGroupRuleBuilder implements Builder { + + private String _description; + private SecurityGroupRule.Direction _direction; + private SecurityGroupRule.EtherType _etherType; + private String _id; + private Uint16 _portRangeMax; + private Uint16 _portRangeMin; + private SecurityGroupRule.Protocol _protocol; + private SecurityGroupRuleKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public SecurityGroupRuleBuilder() { + } + + public SecurityGroupRuleBuilder(SecurityGroupRule base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._description = base.getDescription(); + this._direction = base.getDirection(); + this._etherType = base.getEtherType(); + this._portRangeMax = base.getPortRangeMax(); + this._portRangeMin = base.getPortRangeMin(); + this._protocol = base.getProtocol(); + } + + + public SecurityGroupRuleKey key() { + return key; + } + + public String getDescription() { + return _description; + } + + public SecurityGroupRule.Direction getDirection() { + return _direction; + } + + public SecurityGroupRule.EtherType getEtherType() { + return _etherType; + } + + public String getId() { + return _id; + } + + public Uint16 getPortRangeMax() { + return _portRangeMax; + } + + public Uint16 getPortRangeMin() { + return _portRangeMin; + } + + public SecurityGroupRule.Protocol getProtocol() { + return _protocol; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public SecurityGroupRuleBuilder withKey(final SecurityGroupRuleKey key) { + this.key = key; + return this; + } + + public SecurityGroupRuleBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public SecurityGroupRuleBuilder setDirection(final SecurityGroupRule.Direction value) { + this._direction = value; + return this; + } + + public SecurityGroupRuleBuilder setEtherType(final SecurityGroupRule.EtherType value) { + this._etherType = value; + return this; + } + + public SecurityGroupRuleBuilder setId(final String value) { + this._id = value; + return this; + } + + public SecurityGroupRuleBuilder setPortRangeMax(final Uint16 value) { + this._portRangeMax = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setPortRangeMax(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public SecurityGroupRuleBuilder setPortRangeMax(final Integer value) { + return setPortRangeMax(CodeHelpers.compatUint(value)); + } + + public SecurityGroupRuleBuilder setPortRangeMin(final Uint16 value) { + this._portRangeMin = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setPortRangeMin(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public SecurityGroupRuleBuilder setPortRangeMin(final Integer value) { + return setPortRangeMin(CodeHelpers.compatUint(value)); + } + + public SecurityGroupRuleBuilder setProtocol(final SecurityGroupRule.Protocol value) { + this._protocol = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public SecurityGroupRuleBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public SecurityGroupRuleBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public SecurityGroupRuleBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private SecurityGroupRuleBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public SecurityGroupRule build() { + return new SecurityGroupRuleImpl(this); + } + + private static final class SecurityGroupRuleImpl + extends AbstractAugmentable + implements SecurityGroupRule { + + private final String _description; + private final SecurityGroupRule.Direction _direction; + private final SecurityGroupRule.EtherType _etherType; + private final String _id; + private final Uint16 _portRangeMax; + private final Uint16 _portRangeMin; + private final SecurityGroupRule.Protocol _protocol; + private final SecurityGroupRuleKey key; + + SecurityGroupRuleImpl(SecurityGroupRuleBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new SecurityGroupRuleKey(base.getId()); + } + this._id = key.getId(); + this._description = base.getDescription(); + this._direction = base.getDirection(); + this._etherType = base.getEtherType(); + this._portRangeMax = base.getPortRangeMax(); + this._portRangeMin = base.getPortRangeMin(); + this._protocol = base.getProtocol(); + } + + @Override + public SecurityGroupRuleKey key() { + return key; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public SecurityGroupRule.Direction getDirection() { + return _direction; + } + + @Override + public SecurityGroupRule.EtherType getEtherType() { + return _etherType; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Uint16 getPortRangeMax() { + return _portRangeMax; + } + + @Override + public Uint16 getPortRangeMin() { + return _portRangeMin; + } + + @Override + public SecurityGroupRule.Protocol getProtocol() { + return _protocol; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_direction); + result = prime * result + Objects.hashCode(_etherType); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_portRangeMax); + result = prime * result + Objects.hashCode(_portRangeMin); + result = prime * result + Objects.hashCode(_protocol); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!SecurityGroupRule.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + SecurityGroupRule other = (SecurityGroupRule)obj; + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_direction, other.getDirection())) { + return false; + } + if (!Objects.equals(_etherType, other.getEtherType())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_portRangeMax, other.getPortRangeMax())) { + return false; + } + if (!Objects.equals(_portRangeMin, other.getPortRangeMin())) { + return false; + } + if (!Objects.equals(_protocol, other.getProtocol())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + SecurityGroupRuleImpl otherImpl = (SecurityGroupRuleImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("SecurityGroupRule"); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_direction", _direction); + CodeHelpers.appendValue(helper, "_etherType", _etherType); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_portRangeMax", _portRangeMax); + CodeHelpers.appendValue(helper, "_portRangeMin", _portRangeMin); + CodeHelpers.appendValue(helper, "_protocol", _protocol); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/security/group/rule/SecurityGroupRuleKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/security/group/rule/SecurityGroupRuleKey.java new file mode 100644 index 0000000000000000000000000000000000000000..3a800a36b2e00815eb7b01ed1e3ab15e88282355 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/security/group/rule/SecurityGroupRuleKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class SecurityGroupRuleKey + implements Identifier { + private static final long serialVersionUID = 5462535903571843209L; + private final String _id; + + + public SecurityGroupRuleKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public SecurityGroupRuleKey(SecurityGroupRuleKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof SecurityGroupRuleKey)) { + return false; + } + final SecurityGroupRuleKey other = (SecurityGroupRuleKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(SecurityGroupRuleKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/VirtualNetworkInterfaceRequirement.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/VirtualNetworkInterfaceRequirement.java new file mode 100644 index 0000000000000000000000000000000000000000..d2f35f9d62858ff409b622748a06ce7dc810395a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/VirtualNetworkInterfaceRequirement.java @@ -0,0 +1,123 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.virtual.network._interface.requirement.NetworkInterfaceRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.virtual.network._interface.requirement.NetworkInterfaceRequirementsKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies requirements on a virtual network interface realising the CPs + * instantiated from this CPD. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list virtual-network-interface-requirement {
+ *   key name;
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   leaf support-mandatory {
+ *     default false;
+ *     type boolean;
+ *   }
+ *   list network-interface-requirements {
+ *     key key;
+ *     min-elements 1;
+ *     max-elements 1;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/virtual-network-interface-requirements/virtual-network-interface-requirement + * + *

To create instances of this class use {@link VirtualNetworkInterfaceRequirementBuilder}. + * @see VirtualNetworkInterfaceRequirementBuilder + * @see VirtualNetworkInterfaceRequirementKey + * + */ +public interface VirtualNetworkInterfaceRequirement + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-network-interface-requirement"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.VirtualNetworkInterfaceRequirement.class; + } + + /** + * Provides a human readable name for the requirement. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Provides a human readable description of the requirement. + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * Indicates whether fulfilling the constraint is mandatory (true) for successful + * operation or desirable (false). + * + * + * + * @return java.lang.Boolean supportMandatory, or null if not present + */ + @Nullable Boolean isSupportMandatory(); + + /** + * The network interface requirements. An element from an array of key-value pairs + * that articulate the network interface deployment requirements. + * + * + * + * @return java.util.Map networkInterfaceRequirements, or null if not present + */ + @Nullable Map getNetworkInterfaceRequirements(); + + /** + * @return java.util.Map networkInterfaceRequirements, or an empty list if it is not present + */ + default @NonNull Map nonnullNetworkInterfaceRequirements() { + return CodeHelpers.nonnull(getNetworkInterfaceRequirements()); + } + + @Override + VirtualNetworkInterfaceRequirementKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/VirtualNetworkInterfaceRequirementBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/VirtualNetworkInterfaceRequirementBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..ddf4929614ef616091ceb95fadc0419fd3546c04 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/VirtualNetworkInterfaceRequirementBuilder.java @@ -0,0 +1,338 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.virtual.network._interface.requirement.NetworkInterfaceRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.virtual.network._interface.requirement.NetworkInterfaceRequirementsKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualNetworkInterfaceRequirementBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualNetworkInterfaceRequirementBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualNetworkInterfaceRequirementBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualNetworkInterfaceRequirementBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualNetworkInterfaceRequirementBuilder + * @see Builder + * + */ +public class VirtualNetworkInterfaceRequirementBuilder implements Builder { + + private String _description; + private String _name; + private Map _networkInterfaceRequirements; + private Boolean _supportMandatory; + private VirtualNetworkInterfaceRequirementKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualNetworkInterfaceRequirementBuilder() { + } + + public VirtualNetworkInterfaceRequirementBuilder(VirtualNetworkInterfaceRequirement base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._name = base.getName(); + this._description = base.getDescription(); + this._networkInterfaceRequirements = base.getNetworkInterfaceRequirements(); + this._supportMandatory = base.isSupportMandatory(); + } + + + public VirtualNetworkInterfaceRequirementKey key() { + return key; + } + + public String getDescription() { + return _description; + } + + public String getName() { + return _name; + } + + public Map getNetworkInterfaceRequirements() { + return _networkInterfaceRequirements; + } + + public Boolean isSupportMandatory() { + return _supportMandatory; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VirtualNetworkInterfaceRequirementBuilder withKey(final VirtualNetworkInterfaceRequirementKey key) { + this.key = key; + return this; + } + + public VirtualNetworkInterfaceRequirementBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public VirtualNetworkInterfaceRequirementBuilder setName(final String value) { + this._name = value; + return this; + } + public VirtualNetworkInterfaceRequirementBuilder setNetworkInterfaceRequirements(final Map values) { + this._networkInterfaceRequirements = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setNetworkInterfaceRequirements(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualNetworkInterfaceRequirementBuilder setNetworkInterfaceRequirements(final List values) { + return setNetworkInterfaceRequirements(CodeHelpers.compatMap(values)); + } + + public VirtualNetworkInterfaceRequirementBuilder setSupportMandatory(final Boolean value) { + this._supportMandatory = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualNetworkInterfaceRequirementBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualNetworkInterfaceRequirementBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualNetworkInterfaceRequirementBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualNetworkInterfaceRequirementBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualNetworkInterfaceRequirement build() { + return new VirtualNetworkInterfaceRequirementImpl(this); + } + + private static final class VirtualNetworkInterfaceRequirementImpl + extends AbstractAugmentable + implements VirtualNetworkInterfaceRequirement { + + private final String _description; + private final String _name; + private final Map _networkInterfaceRequirements; + private final Boolean _supportMandatory; + private final VirtualNetworkInterfaceRequirementKey key; + + VirtualNetworkInterfaceRequirementImpl(VirtualNetworkInterfaceRequirementBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VirtualNetworkInterfaceRequirementKey(base.getName()); + } + this._name = key.getName(); + this._description = base.getDescription(); + this._networkInterfaceRequirements = CodeHelpers.emptyToNull(base.getNetworkInterfaceRequirements()); + this._supportMandatory = base.isSupportMandatory(); + } + + @Override + public VirtualNetworkInterfaceRequirementKey key() { + return key; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public String getName() { + return _name; + } + + @Override + public Map getNetworkInterfaceRequirements() { + return _networkInterfaceRequirements; + } + + @Override + public Boolean isSupportMandatory() { + return _supportMandatory; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_networkInterfaceRequirements); + result = prime * result + Objects.hashCode(_supportMandatory); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualNetworkInterfaceRequirement.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualNetworkInterfaceRequirement other = (VirtualNetworkInterfaceRequirement)obj; + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_networkInterfaceRequirements, other.getNetworkInterfaceRequirements())) { + return false; + } + if (!Objects.equals(_supportMandatory, other.isSupportMandatory())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualNetworkInterfaceRequirementImpl otherImpl = (VirtualNetworkInterfaceRequirementImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualNetworkInterfaceRequirement"); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_networkInterfaceRequirements", _networkInterfaceRequirements); + CodeHelpers.appendValue(helper, "_supportMandatory", _supportMandatory); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/VirtualNetworkInterfaceRequirementKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/VirtualNetworkInterfaceRequirementKey.java new file mode 100644 index 0000000000000000000000000000000000000000..1f5418272792577b55d19d5c16ad2f9a81f476a2 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/VirtualNetworkInterfaceRequirementKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VirtualNetworkInterfaceRequirementKey + implements Identifier { + private static final long serialVersionUID = 7680743484721154658L; + private final String _name; + + + public VirtualNetworkInterfaceRequirementKey(String _name) { + + this._name = _name; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VirtualNetworkInterfaceRequirementKey(VirtualNetworkInterfaceRequirementKey source) { + this._name = source._name; + } + + + public String getName() { + return _name; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_name); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VirtualNetworkInterfaceRequirementKey)) { + return false; + } + final VirtualNetworkInterfaceRequirementKey other = (VirtualNetworkInterfaceRequirementKey) obj; + if (!Objects.equals(_name, other._name)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VirtualNetworkInterfaceRequirementKey.class); + CodeHelpers.appendValue(helper, "_name", _name); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/virtual/network/_interface/requirement/NetworkInterfaceRequirements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/virtual/network/_interface/requirement/NetworkInterfaceRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..6f81c81dbd4c2a2d396af2a32ee36f4306ef4c68 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/virtual/network/_interface/requirement/NetworkInterfaceRequirements.java @@ -0,0 +1,70 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.virtual.network._interface.requirement; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.VirtualNetworkInterfaceRequirement; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The network interface requirements. An element from an array of key-value pairs + * that articulate the network interface deployment requirements. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list network-interface-requirements {
+ *   key key;
+ *   min-elements 1;
+ *   max-elements 1;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/virtual-network-interface-requirements/virtual-network-interface-requirement/network-interface-requirements + * + *

To create instances of this class use {@link NetworkInterfaceRequirementsBuilder}. + * @see NetworkInterfaceRequirementsBuilder + * @see NetworkInterfaceRequirementsKey + * + */ +public interface NetworkInterfaceRequirements + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("network-interface-requirements"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.virtual.network._interface.requirement.NetworkInterfaceRequirements.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + NetworkInterfaceRequirementsKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/virtual/network/_interface/requirement/NetworkInterfaceRequirementsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/virtual/network/_interface/requirement/NetworkInterfaceRequirementsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..fa55beeb967080fb3dfbb7659ad2dd2c6c8b263f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/virtual/network/_interface/requirement/NetworkInterfaceRequirementsBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.virtual.network._interface.requirement; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NetworkInterfaceRequirementsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NetworkInterfaceRequirementsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NetworkInterfaceRequirementsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NetworkInterfaceRequirementsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NetworkInterfaceRequirementsBuilder + * @see Builder + * + */ +public class NetworkInterfaceRequirementsBuilder implements Builder { + + private String _key; + private String _value; + private NetworkInterfaceRequirementsKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NetworkInterfaceRequirementsBuilder() { + } + + public NetworkInterfaceRequirementsBuilder(NetworkInterfaceRequirements base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public NetworkInterfaceRequirementsKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public NetworkInterfaceRequirementsBuilder withKey(final NetworkInterfaceRequirementsKey key) { + this.key = key; + return this; + } + + public NetworkInterfaceRequirementsBuilder setKey(final String value) { + this._key = value; + return this; + } + + public NetworkInterfaceRequirementsBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NetworkInterfaceRequirementsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NetworkInterfaceRequirementsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NetworkInterfaceRequirementsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NetworkInterfaceRequirementsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public NetworkInterfaceRequirements build() { + return new NetworkInterfaceRequirementsImpl(this); + } + + private static final class NetworkInterfaceRequirementsImpl + extends AbstractAugmentable + implements NetworkInterfaceRequirements { + + private final String _key; + private final String _value; + private final NetworkInterfaceRequirementsKey key; + + NetworkInterfaceRequirementsImpl(NetworkInterfaceRequirementsBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new NetworkInterfaceRequirementsKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public NetworkInterfaceRequirementsKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!NetworkInterfaceRequirements.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + NetworkInterfaceRequirements other = (NetworkInterfaceRequirements)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NetworkInterfaceRequirementsImpl otherImpl = (NetworkInterfaceRequirementsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("NetworkInterfaceRequirements"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/virtual/network/_interface/requirement/NetworkInterfaceRequirementsKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/virtual/network/_interface/requirement/NetworkInterfaceRequirementsKey.java new file mode 100644 index 0000000000000000000000000000000000000000..878cc917da306f0e9e58fd35f951b12de7f883ca --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/virtual/network/_interface/requirements/virtual/network/_interface/requirement/NetworkInterfaceRequirementsKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.virtual.network._interface.requirement; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class NetworkInterfaceRequirementsKey + implements Identifier { + private static final long serialVersionUID = -5518541956212500630L; + private final String _key; + + + public NetworkInterfaceRequirementsKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public NetworkInterfaceRequirementsKey(NetworkInterfaceRequirementsKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof NetworkInterfaceRequirementsKey)) { + return false; + } + final NetworkInterfaceRequirementsKey other = (NetworkInterfaceRequirementsKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(NetworkInterfaceRequirementsKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ConfigurableProperties.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ConfigurableProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..57a7c8d9cb08c06b2b279c4953c40071bb28f8ee --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ConfigurableProperties.java @@ -0,0 +1,99 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.configurable.properties.AdditionalConfigurableProperty; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.configurable.properties.AdditionalConfigurablePropertyKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes the configurable properties of the VNF (e.g. related to auto scaling + * and auto healing). + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container configurable-properties {
+ *   leaf is-auto-scalable-enabled {
+ *     type boolean;
+ *   }
+ *   leaf is-auto-heal-enabled {
+ *     type boolean;
+ *   }
+ *   list additional-configurable-property {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/configurable-properties + * + *

To create instances of this class use {@link ConfigurablePropertiesBuilder}. + * @see ConfigurablePropertiesBuilder + * + */ +public interface ConfigurableProperties + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("configurable-properties"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ConfigurableProperties.class; + } + + /** + * It permits to enable (TRUE) / disable (FALSE) the auto-scaling functionality. + * + * + * + * @return java.lang.Boolean isAutoScalableEnabled, or null if not present + */ + @Nullable Boolean isIsAutoScalableEnabled(); + + /** + * It permits to enable (TRUE) / disable (FALSE) the auto-healing functionality. + * + * + * + * @return java.lang.Boolean isAutoHealEnabled, or null if not present + */ + @Nullable Boolean isIsAutoHealEnabled(); + + /** + * It provides VNF specific configurable properties that can be modified using the + * ModifyVnfConfiguration operation. + * + * + * + * @return java.util.Map additionalConfigurableProperty, or null if not present + */ + @Nullable Map getAdditionalConfigurableProperty(); + + /** + * @return java.util.Map additionalConfigurableProperty, or an empty list if it is not present + */ + default @NonNull Map nonnullAdditionalConfigurableProperty() { + return CodeHelpers.nonnull(getAdditionalConfigurableProperty()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ConfigurablePropertiesBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ConfigurablePropertiesBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..ace99724f1f706a6b93a58c024d3213abb3d873a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ConfigurablePropertiesBuilder.java @@ -0,0 +1,294 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.configurable.properties.AdditionalConfigurableProperty; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.configurable.properties.AdditionalConfigurablePropertyKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ConfigurablePropertiesBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ConfigurablePropertiesBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ConfigurablePropertiesBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ConfigurablePropertiesBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ConfigurablePropertiesBuilder + * @see Builder + * + */ +public class ConfigurablePropertiesBuilder implements Builder { + + private Map _additionalConfigurableProperty; + private Boolean _isAutoHealEnabled; + private Boolean _isAutoScalableEnabled; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ConfigurablePropertiesBuilder() { + } + + public ConfigurablePropertiesBuilder(ConfigurableProperties base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._additionalConfigurableProperty = base.getAdditionalConfigurableProperty(); + this._isAutoHealEnabled = base.isIsAutoHealEnabled(); + this._isAutoScalableEnabled = base.isIsAutoScalableEnabled(); + } + + + public Map getAdditionalConfigurableProperty() { + return _additionalConfigurableProperty; + } + + public Boolean isIsAutoHealEnabled() { + return _isAutoHealEnabled; + } + + public Boolean isIsAutoScalableEnabled() { + return _isAutoScalableEnabled; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ConfigurablePropertiesBuilder setAdditionalConfigurableProperty(final Map values) { + this._additionalConfigurableProperty = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setAdditionalConfigurableProperty(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ConfigurablePropertiesBuilder setAdditionalConfigurableProperty(final List values) { + return setAdditionalConfigurableProperty(CodeHelpers.compatMap(values)); + } + + public ConfigurablePropertiesBuilder setIsAutoHealEnabled(final Boolean value) { + this._isAutoHealEnabled = value; + return this; + } + + public ConfigurablePropertiesBuilder setIsAutoScalableEnabled(final Boolean value) { + this._isAutoScalableEnabled = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ConfigurablePropertiesBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ConfigurablePropertiesBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ConfigurablePropertiesBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ConfigurablePropertiesBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ConfigurableProperties build() { + return new ConfigurablePropertiesImpl(this); + } + + private static final class ConfigurablePropertiesImpl + extends AbstractAugmentable + implements ConfigurableProperties { + + private final Map _additionalConfigurableProperty; + private final Boolean _isAutoHealEnabled; + private final Boolean _isAutoScalableEnabled; + + ConfigurablePropertiesImpl(ConfigurablePropertiesBuilder base) { + super(base.augmentation); + this._additionalConfigurableProperty = CodeHelpers.emptyToNull(base.getAdditionalConfigurableProperty()); + this._isAutoHealEnabled = base.isIsAutoHealEnabled(); + this._isAutoScalableEnabled = base.isIsAutoScalableEnabled(); + } + + @Override + public Map getAdditionalConfigurableProperty() { + return _additionalConfigurableProperty; + } + + @Override + public Boolean isIsAutoHealEnabled() { + return _isAutoHealEnabled; + } + + @Override + public Boolean isIsAutoScalableEnabled() { + return _isAutoScalableEnabled; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_additionalConfigurableProperty); + result = prime * result + Objects.hashCode(_isAutoHealEnabled); + result = prime * result + Objects.hashCode(_isAutoScalableEnabled); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ConfigurableProperties.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ConfigurableProperties other = (ConfigurableProperties)obj; + if (!Objects.equals(_additionalConfigurableProperty, other.getAdditionalConfigurableProperty())) { + return false; + } + if (!Objects.equals(_isAutoHealEnabled, other.isIsAutoHealEnabled())) { + return false; + } + if (!Objects.equals(_isAutoScalableEnabled, other.isIsAutoScalableEnabled())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ConfigurablePropertiesImpl otherImpl = (ConfigurablePropertiesImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ConfigurableProperties"); + CodeHelpers.appendValue(helper, "_additionalConfigurableProperty", _additionalConfigurableProperty); + CodeHelpers.appendValue(helper, "_isAutoHealEnabled", _isAutoHealEnabled); + CodeHelpers.appendValue(helper, "_isAutoScalableEnabled", _isAutoScalableEnabled); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/Df.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/Df.java new file mode 100644 index 0000000000000000000000000000000000000000..8dda1c32bf0453db02d094c222ae05656478de3d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/Df.java @@ -0,0 +1,694 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SupportedOperation; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.DfBuilder.DfImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.Indicator; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.IndicatorKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.InstantiationLevel; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.InstantiationLevelKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.MonitoringParameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.MonitoringParameterKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.ScalingAspect; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.ScalingAspectKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.SupportedVnfInterfaces; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.SupportedVnfInterfacesKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VduProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VduProfileKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VirtualLinkProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VirtualLinkProfileKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Describes a specific Deployment Flavour (DF) of a VNF with specific + * for capacity and performance. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list df {
+ *   must "default-instantiation-level or count(instantiation-level) = 1";
+ *   key id;
+ *   min-elements 1;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   list vdu-profile {
+ *     key id;
+ *     min-elements 1;
+ *     leaf id {
+ *       type leafref {
+ *         path ../../../vdu/id;
+ *       }
+ *     }
+ *     leaf min-number-of-instances {
+ *       type uint16;
+ *       default 1;
+ *     }
+ *     leaf max-number-of-instances {
+ *       type uint16;
+ *       default 1;
+ *       must ". >= ../min-number-of-instances";
+ *     }
+ *     uses local-affinity-or-anti-affinity-rule;
+ *     list affinity-or-anti-affinity-group {
+ *       key id;
+ *       leaf id {
+ *         type leafref {
+ *           path ../../../affinity-or-anti-affinity-group/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   list virtual-link-profile {
+ *     key "id flavour";
+ *     leaf id {
+ *       type leafref {
+ *         path ../../../int-virtual-link-desc/id;
+ *       }
+ *     }
+ *     leaf flavour {
+ *       type leafref {
+ *         path ../../../flavour/id;
+ *       }
+ *     }
+ *     uses local-affinity-or-anti-affinity-rule;
+ *     list affinity-or-anti-affinity-group {
+ *       key id;
+ *       leaf id {
+ *         type leafref {
+ *           path ../../../affinity-or-anti-affinity-group/id;
+ *         }
+ *       }
+ *     }
+ *     container max-bit-rate-requirements {
+ *       leaf root {
+ *         type uint32;
+ *       }
+ *       leaf leaf {
+ *         type uint32;
+ *       }
+ *     }
+ *     container min-bit-rate-requirements {
+ *       leaf root {
+ *         type uint32;
+ *       }
+ *       leaf leaf {
+ *         type uint32;
+ *       }
+ *     }
+ *     container virtual-link-protocol-data {
+ *       leaf associated-layer-protocol {
+ *         type identityref {
+ *           base layer-protocol;
+ *         }
+ *       }
+ *       container l2-protocol-data {
+ *         when "(../associated-layer-protocol = 'Ethernet') or (../associated-layer-protocol = 'MPLS') or (../associated-layer-protocol = 'ODU2') or (../associated-layer-protocol = 'Pseudo-Wire')";
+ *         leaf name {
+ *           type string;
+ *         }
+ *         leaf network-type {
+ *           type enumeration {
+ *             enum flat;
+ *             enum vlan;
+ *             enum vxlan;
+ *             enum gre;
+ *           }
+ *         }
+ *         leaf vlan-transparent {
+ *           type boolean;
+ *         }
+ *         leaf mtu {
+ *           type uint16;
+ *         }
+ *       }
+ *       container l3-protocol-data {
+ *         when "(../associated-layer-protocol = 'IPv4') or (../associated-layer-protocol = 'IPv6')";
+ *         leaf name {
+ *           type string;
+ *         }
+ *         leaf ip-version {
+ *           type enumeration {
+ *             enum ipv4;
+ *             enum ipv6;
+ *           }
+ *           default ipv4;
+ *         }
+ *         leaf cidr {
+ *           type string;
+ *         }
+ *         leaf-list ip-allocation-pools {
+ *           type string;
+ *         }
+ *         leaf gateway-ip {
+ *           type inet:ip-address;
+ *         }
+ *         leaf dhcp-enabled {
+ *           type boolean;
+ *           default true;
+ *         }
+ *         leaf ipv6-address-mode {
+ *           when "../ip-version = 'ipv6'";
+ *           type enumeration {
+ *             enum slaac;
+ *             enum dhcpv6-stateful;
+ *             enum dhcpv6-stateless;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ *   list instantiation-level {
+ *     key id;
+ *     min-elements 1;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     list vdu-level {
+ *       key vdu-id;
+ *       min-elements 1;
+ *       leaf vdu-id {
+ *         type leafref {
+ *           path ../../../../vdu/id;
+ *         }
+ *       }
+ *       leaf number-of-instances {
+ *         type uint16;
+ *         must ". <= ../../../../df/vdu-profile[id=current()/../vdu-id]/max-number-of-instances";
+ *         must ". >= ../../../../df/vdu-profile[id=current()/../vdu-id]/min-number-of-instances";
+ *         default 1;
+ *       }
+ *     }
+ *     list scaling-info {
+ *       key scaling-aspect-id;
+ *       leaf scaling-aspect-id {
+ *         type leafref {
+ *           path ../../../scaling-aspect/id;
+ *         }
+ *       }
+ *       leaf scale-level {
+ *         type uint32;
+ *       }
+ *     }
+ *   }
+ *   leaf default-instantiation-level {
+ *     type leafref {
+ *       path ../instantiation-level/id;
+ *     }
+ *   }
+ *   leaf-list supported-operation {
+ *     type identityref {
+ *       base supported-operation;
+ *     }
+ *   }
+ *   container lcm-operations-configuration {
+ *     container instantiate-vnf-op-config {
+ *       list parameter {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *     container scale-vnf-op-config {
+ *       list parameter {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *       leaf scaling-by-more-than-one-step-supported {
+ *         type boolean;
+ *         default false;
+ *       }
+ *     }
+ *     container scale-vnf-to-level-op-config {
+ *       list parameter {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *       leaf arbitrary-target-levels-supported {
+ *         type boolean;
+ *         default false;
+ *       }
+ *     }
+ *     container heal-vnf-op-config {
+ *       list parameter {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *       leaf-list cause {
+ *         type string;
+ *       }
+ *     }
+ *     container terminate-vnf-op-config {
+ *       leaf min-graceful-termination {
+ *         type yang:timeticks;
+ *         default 1;
+ *       }
+ *       leaf max-recommended-graceful-termination {
+ *         type yang:timeticks;
+ *       }
+ *       list parameter {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *     container operate-vnf-op-config {
+ *       leaf min-graceful-stop-timeout {
+ *         type yang:timeticks;
+ *         default 1;
+ *       }
+ *       leaf max-recommended-graceful-stop-timeout {
+ *         type yang:timeticks;
+ *       }
+ *       list parameter {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *     container change-vnf-flavour-op-config {
+ *       list parameter {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *     container change-ext-vnf-connectivity-op-config {
+ *       list parameter {
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   list affinity-or-anti-affinity-group {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf type {
+ *       type affinity-type;
+ *     }
+ *     leaf scope {
+ *       type affinity-scope;
+ *     }
+ *   }
+ *   list indicator {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf indicator-value {
+ *       type string;
+ *     }
+ *     leaf source {
+ *       type enumeration {
+ *         enum vnf;
+ *         enum em;
+ *         enum both;
+ *       }
+ *     }
+ *   }
+ *   list supported-vnf-interfaces {
+ *     key name;
+ *     leaf name {
+ *       type enumeration {
+ *         enum vnf-configuration;
+ *         enum vnf-indicator;
+ *       }
+ *     }
+ *     leaf-list cpd-id {
+ *       type leafref {
+ *         path ../../../ext-cpd/id;
+ *       }
+ *     }
+ *     list interface-details {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   list monitoring-parameter {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     uses monitoring-parameter;
+ *   }
+ *   list scaling-aspect {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     leaf max-scale-level {
+ *       type uint32 {
+ *         range 1..max;
+ *       }
+ *     }
+ *     container aspect-delta-details {
+ *       list deltas {
+ *         key id;
+ *         min-elements 1;
+ *         leaf id {
+ *           type string;
+ *         }
+ *         list vdu-delta {
+ *           key id;
+ *           leaf id {
+ *             type leafref {
+ *               path ../../../../../../vdu/id;
+ *             }
+ *           }
+ *           leaf number-of-instances {
+ *             type uint32 {
+ *               range 0..max;
+ *             }
+ *           }
+ *         }
+ *         list virtual-link-bit-rate-delta {
+ *           key id;
+ *           leaf id {
+ *             type string;
+ *           }
+ *           container bit-rate-requirements {
+ *             leaf root {
+ *               type uint32;
+ *               units bits/sec;
+ *             }
+ *             leaf leaf {
+ *               type uint32;
+ *               units bits/sec;
+ *             }
+ *           }
+ *         }
+ *       }
+ *       leaf step-deltas {
+ *         type leafref {
+ *           path ../deltas/id;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df + * + *

To create instances of this class use {@link DfBuilder}. + * @see DfBuilder + * @see DfKey + * + */ +@JsonDeserialize(as = DfImpl.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public interface Df + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("df"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df.class; + } + + /** + * Identifier of this DF within the VNFD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Human readable description of the deployment flavour + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * The Vduprofile describes additional instantiation data for a given VDU used in a + * deployment flavour. + * + * + * + * @return java.util.Map vduProfile, or null if not present + */ + @Nullable Map getVduProfile(); + + /** + * @return java.util.Map vduProfile, or an empty list if it is not present + */ + default @NonNull Map nonnullVduProfile() { + return CodeHelpers.nonnull(getVduProfile()); + } + + /** + * Defines the internal VLD along with additional data which is used in this DF. + * + * + * + * @return java.util.Map virtualLinkProfile, or null if not present + */ + @JsonDeserialize(keyUsing = VirtualLinkProfileKey.class) + @Nullable Map getVirtualLinkProfile(); + + /** + * @return java.util.Map virtualLinkProfile, or an empty list if it is not present + */ + default @NonNull Map nonnullVirtualLinkProfile() { + return CodeHelpers.nonnull(getVirtualLinkProfile()); + } + + /** + * Describes the various levels of resources that can be used to instantiate the + * VNF using this flavour. Examples: Small, Medium, Large. If there is only one + * 'instantiationLevel' entry, it shall be treated as the default instantiation + * level for this DF. The InstantiationLevel information element describes a given + * level of resources to be instantiated within a deployment flavour in term of the + * number of VNFC instances to be created from each VDU. All the VDUs referenced in + * the level shall be part of the corresponding deployment flavour and their number + * shall be within the range (min/max) for this deployment flavour. + * + * + * + * @return java.util.Map instantiationLevel, or null if not present + */ + @Nullable Map getInstantiationLevel(); + + /** + * @return java.util.Map instantiationLevel, or an empty list if it is not present + */ + default @NonNull Map nonnullInstantiationLevel() { + return CodeHelpers.nonnull(getInstantiationLevel()); + } + + /** + * This attribute references the 'instantiationLevel' entry which defines the + * default instantiation level for this DF. It shall be present if there are + * multiple 'instantiationLevel' entries. + * + * + * + * @return java.lang.String defaultInstantiationLevel, or null if not present + */ + @Nullable String getDefaultInstantiationLevel(); + + /** + * Indicates which operations are available for this DF via the VNF LCM interface. + * Instantiate VNF, Query VNF and Terminate VNF are supported in all DF and + * therefore need not be included in this list. + * + * + * + * @return java.util.List supportedOperation, or null if not present + */ + @Nullable List> getSupportedOperation(); + + /** + * This information element is a container for all attributes that affect the + * invocation of the VNF Lifecycle Management operations, structured by operation. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration lcmOperationsConfiguration, or null if not present + */ + @Nullable LcmOperationsConfiguration getLcmOperationsConfiguration(); + + /** + * The AffinityOrAntiAffinityGroup describes the affinity or anti-affinity + * relationship applicable between the virtualization containers to be created + * based on different VDUs, or between internal VLs to be created based on + * different VnfVirtualLinkDesc(s). Per VNF, the affinity/anti-affinity rules + * defined using this information element, using the + * LocalAffinityOrAntiAffinityRule information element, and using the placement + * constraints in the GrantLifecycleOperation as defined in ETSI GS NFV-IFA 007 + * [i.3] should be conflict-free. In case of conflicts, the placement constraints + * in the GrantLifecycleOperation shall take precedence. + * + * + * + * @return java.util.Map affinityOrAntiAffinityGroup, or null if not present + */ + @Nullable Map getAffinityOrAntiAffinityGroup(); + + /** + * @return java.util.Map affinityOrAntiAffinityGroup, or an empty list if it is not present + */ + default @NonNull Map nonnullAffinityOrAntiAffinityGroup() { + return CodeHelpers.nonnull(getAffinityOrAntiAffinityGroup()); + } + + /** + * Declares the VNF indicators that are supported by this VNF (specific to this + * DF). + * + * + * + * @return java.util.Map indicator, or null if not present + */ + @Nullable Map getIndicator(); + + /** + * @return java.util.Map indicator, or an empty list if it is not present + */ + default @NonNull Map nonnullIndicator() { + return CodeHelpers.nonnull(getIndicator()); + } + + /** + * Indicates which interfaces the VNF produces and provides additional details on + * how to access the interface endpoints. + * + * + * + * @return java.util.Map supportedVnfInterfaces, or null if not present + */ + @JsonDeserialize(keyUsing = SupportedVnfInterfacesKey.class) + @Nullable Map getSupportedVnfInterfaces(); + + /** + * @return java.util.Map supportedVnfInterfaces, or an empty list if it is not present + */ + default @NonNull Map nonnullSupportedVnfInterfaces() { + return CodeHelpers.nonnull(getSupportedVnfInterfaces()); + } + + /** + * Defines the virtualised resources monitoring parameters on VNF level. + * + * + * + * @return java.util.Map monitoringParameter, or null if not present + */ + @Nullable Map getMonitoringParameter(); + + /** + * @return java.util.Map monitoringParameter, or an empty list if it is not present + */ + default @NonNull Map nonnullMonitoringParameter() { + return CodeHelpers.nonnull(getMonitoringParameter()); + } + + /** + * The scaling aspects supported by this DF of the VNF. scalingAspect shall be + * present if the VNF supports scaling. + * + * + * + * @return java.util.Map scalingAspect, or null if not present + */ + @Nullable Map getScalingAspect(); + + /** + * @return java.util.Map scalingAspect, or an empty list if it is not present + */ + default @NonNull Map nonnullScalingAspect() { + return CodeHelpers.nonnull(getScalingAspect()); + } + + @Override + DfKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/DfBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/DfBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..72cc4af1913cc637a1092331b09dcd1e8cadf029 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/DfBuilder.java @@ -0,0 +1,690 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SupportedOperation; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.Indicator; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.IndicatorKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.InstantiationLevel; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.InstantiationLevelKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.MonitoringParameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.MonitoringParameterKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.ScalingAspect; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.ScalingAspectKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.SupportedVnfInterfaces; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.SupportedVnfInterfacesKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VduProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VduProfileKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VirtualLinkProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VirtualLinkProfileKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link DfBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     DfBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new DfBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of DfBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see DfBuilder + * @see Builder + * + */ +public class DfBuilder implements Builder { + + private Map _affinityOrAntiAffinityGroup; + private String _defaultInstantiationLevel; + private String _description; + private String _id; + private Map _indicator; + private Map _instantiationLevel; + private LcmOperationsConfiguration _lcmOperationsConfiguration; + private Map _monitoringParameter; + private Map _scalingAspect; + private List> _supportedOperation; + private Map _supportedVnfInterfaces; + private Map _vduProfile; + private Map _virtualLinkProfile; + private DfKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public DfBuilder() { + } + + public DfBuilder(Df base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._affinityOrAntiAffinityGroup = base.getAffinityOrAntiAffinityGroup(); + this._defaultInstantiationLevel = base.getDefaultInstantiationLevel(); + this._description = base.getDescription(); + this._indicator = base.getIndicator(); + this._instantiationLevel = base.getInstantiationLevel(); + this._lcmOperationsConfiguration = base.getLcmOperationsConfiguration(); + this._monitoringParameter = base.getMonitoringParameter(); + this._scalingAspect = base.getScalingAspect(); + this._supportedOperation = base.getSupportedOperation(); + this._supportedVnfInterfaces = base.getSupportedVnfInterfaces(); + this._vduProfile = base.getVduProfile(); + this._virtualLinkProfile = base.getVirtualLinkProfile(); + } + + + public DfKey key() { + return key; + } + + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + public String getDefaultInstantiationLevel() { + return _defaultInstantiationLevel; + } + + public String getDescription() { + return _description; + } + + public String getId() { + return _id; + } + + public Map getIndicator() { + return _indicator; + } + + public Map getInstantiationLevel() { + return _instantiationLevel; + } + + public LcmOperationsConfiguration getLcmOperationsConfiguration() { + return _lcmOperationsConfiguration; + } + + public Map getMonitoringParameter() { + return _monitoringParameter; + } + + public Map getScalingAspect() { + return _scalingAspect; + } + + public List> getSupportedOperation() { + return _supportedOperation; + } + + public Map getSupportedVnfInterfaces() { + return _supportedVnfInterfaces; + } + + public Map getVduProfile() { + return _vduProfile; + } + + public Map getVirtualLinkProfile() { + return _virtualLinkProfile; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public DfBuilder withKey(final DfKey key) { + this.key = key; + return this; + } + public DfBuilder setAffinityOrAntiAffinityGroup(final Map values) { + this._affinityOrAntiAffinityGroup = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setAffinityOrAntiAffinityGroup(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setAffinityOrAntiAffinityGroup(final List values) { + return setAffinityOrAntiAffinityGroup(CodeHelpers.compatMap(values)); + } + + public DfBuilder setDefaultInstantiationLevel(final String value) { + this._defaultInstantiationLevel = value; + return this; + } + + public DfBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public DfBuilder setId(final String value) { + this._id = value; + return this; + } + public DfBuilder setIndicator(final Map values) { + this._indicator = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setIndicator(Map)} instead. + */ + @Deprecated(forRemoval = true) + @JsonIgnore + public DfBuilder setIndicator(final List values) { + return setIndicator(CodeHelpers.compatMap(values)); + } + public DfBuilder setInstantiationLevel(final Map values) { + this._instantiationLevel = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setInstantiationLevel(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setInstantiationLevel(final List values) { + return setInstantiationLevel(CodeHelpers.compatMap(values)); + } + + public DfBuilder setLcmOperationsConfiguration(final LcmOperationsConfiguration value) { + this._lcmOperationsConfiguration = value; + return this; + } + public DfBuilder setMonitoringParameter(final Map values) { + this._monitoringParameter = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setMonitoringParameter(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setMonitoringParameter(final List values) { + return setMonitoringParameter(CodeHelpers.compatMap(values)); + } + public DfBuilder setScalingAspect(final Map values) { + this._scalingAspect = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setScalingAspect(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setScalingAspect(final List values) { + return setScalingAspect(CodeHelpers.compatMap(values)); + } + public DfBuilder setSupportedOperation(final List> values) { + this._supportedOperation = values; + return this; + } + + public DfBuilder setSupportedVnfInterfaces(final Map values) { + this._supportedVnfInterfaces = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSupportedVnfInterfaces(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setSupportedVnfInterfaces(final List values) { + return setSupportedVnfInterfaces(CodeHelpers.compatMap(values)); + } + public DfBuilder setVduProfile(final Map values) { + this._vduProfile = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVduProfile(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setVduProfile(final List values) { + return setVduProfile(CodeHelpers.compatMap(values)); + } + public DfBuilder setVirtualLinkProfile(final Map values) { + this._virtualLinkProfile = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualLinkProfile(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder setVirtualLinkProfile(final List values) { + return setVirtualLinkProfile(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public DfBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public DfBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public DfBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private DfBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Df build() { + return new DfImpl(this); + } + + public static final class DfImpl + extends AbstractAugmentable + implements Df { + private final Map _affinityOrAntiAffinityGroup; + private final String _defaultInstantiationLevel; + private final String _description; + private final String _id; + private final Map _indicator; + private final Map _instantiationLevel; + private final LcmOperationsConfiguration _lcmOperationsConfiguration; + private final Map _monitoringParameter; + private final Map _scalingAspect; + private final List> _supportedOperation; + @JsonDeserialize(keyUsing = SupportedVnfInterfacesKey.class) + private final Map _supportedVnfInterfaces; + private final Map _vduProfile; + private final Map _virtualLinkProfile; + private DfKey key; + + DfImpl(DfBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new DfKey(base.getId()); + } + this._id = key.getId(); + this._affinityOrAntiAffinityGroup = CodeHelpers.emptyToNull(base.getAffinityOrAntiAffinityGroup()); + this._defaultInstantiationLevel = base.getDefaultInstantiationLevel(); + this._description = base.getDescription(); + this._indicator = CodeHelpers.emptyToNull(base.getIndicator()); + this._instantiationLevel = CodeHelpers.emptyToNull(base.getInstantiationLevel()); + this._lcmOperationsConfiguration = base.getLcmOperationsConfiguration(); + this._monitoringParameter = CodeHelpers.emptyToNull(base.getMonitoringParameter()); + this._scalingAspect = CodeHelpers.emptyToNull(base.getScalingAspect()); + this._supportedOperation = base.getSupportedOperation(); + this._supportedVnfInterfaces = CodeHelpers.emptyToNull(base.getSupportedVnfInterfaces()); + this._vduProfile = CodeHelpers.emptyToNull(base.getVduProfile()); + this._virtualLinkProfile = CodeHelpers.emptyToNull(base.getVirtualLinkProfile()); + } + + public DfImpl() { + this( new DfBuilder()); + } + + + @Override + public DfKey key() { + if ( ( key != null) && ( key.getId() == null) && ( _id != null) ) { + key = new DfKey(_id); + } + return key; + } + + @Override + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + @Override + public String getDefaultInstantiationLevel() { + return _defaultInstantiationLevel; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getIndicator() { + return _indicator; + } + + @Override + public Map getInstantiationLevel() { + return _instantiationLevel; + } + + @Override + public LcmOperationsConfiguration getLcmOperationsConfiguration() { + return _lcmOperationsConfiguration; + } + + @Override + public Map getMonitoringParameter() { + return _monitoringParameter; + } + + @Override + public Map getScalingAspect() { + return _scalingAspect; + } + + @Override + public List> getSupportedOperation() { + return _supportedOperation; + } + + @Override + public Map getSupportedVnfInterfaces() { + return _supportedVnfInterfaces; + } + + @Override + public Map getVduProfile() { + return _vduProfile; + } + + @Override + public Map getVirtualLinkProfile() { + return _virtualLinkProfile; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_affinityOrAntiAffinityGroup); + result = prime * result + Objects.hashCode(_defaultInstantiationLevel); + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_indicator); + result = prime * result + Objects.hashCode(_instantiationLevel); + result = prime * result + Objects.hashCode(_lcmOperationsConfiguration); + result = prime * result + Objects.hashCode(_monitoringParameter); + result = prime * result + Objects.hashCode(_scalingAspect); + result = prime * result + Objects.hashCode(_supportedOperation); + result = prime * result + Objects.hashCode(_supportedVnfInterfaces); + result = prime * result + Objects.hashCode(_vduProfile); + result = prime * result + Objects.hashCode(_virtualLinkProfile); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Df.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Df other = (Df)obj; + if (!Objects.equals(_affinityOrAntiAffinityGroup, other.getAffinityOrAntiAffinityGroup())) { + return false; + } + if (!Objects.equals(_defaultInstantiationLevel, other.getDefaultInstantiationLevel())) { + return false; + } + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_indicator, other.getIndicator())) { + return false; + } + if (!Objects.equals(_instantiationLevel, other.getInstantiationLevel())) { + return false; + } + if (!Objects.equals(_lcmOperationsConfiguration, other.getLcmOperationsConfiguration())) { + return false; + } + if (!Objects.equals(_monitoringParameter, other.getMonitoringParameter())) { + return false; + } + if (!Objects.equals(_scalingAspect, other.getScalingAspect())) { + return false; + } + if (!Objects.equals(_supportedOperation, other.getSupportedOperation())) { + return false; + } + if (!Objects.equals(_supportedVnfInterfaces, other.getSupportedVnfInterfaces())) { + return false; + } + if (!Objects.equals(_vduProfile, other.getVduProfile())) { + return false; + } + if (!Objects.equals(_virtualLinkProfile, other.getVirtualLinkProfile())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + DfImpl otherImpl = (DfImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Df"); + CodeHelpers.appendValue(helper, "_affinityOrAntiAffinityGroup", _affinityOrAntiAffinityGroup); + CodeHelpers.appendValue(helper, "_defaultInstantiationLevel", _defaultInstantiationLevel); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_indicator", _indicator); + CodeHelpers.appendValue(helper, "_instantiationLevel", _instantiationLevel); + CodeHelpers.appendValue(helper, "_lcmOperationsConfiguration", _lcmOperationsConfiguration); + CodeHelpers.appendValue(helper, "_monitoringParameter", _monitoringParameter); + CodeHelpers.appendValue(helper, "_scalingAspect", _scalingAspect); + CodeHelpers.appendValue(helper, "_supportedOperation", _supportedOperation); + CodeHelpers.appendValue(helper, "_supportedVnfInterfaces", _supportedVnfInterfaces); + CodeHelpers.appendValue(helper, "_vduProfile", _vduProfile); + CodeHelpers.appendValue(helper, "_virtualLinkProfile", _virtualLinkProfile); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/DfKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/DfKey.java new file mode 100644 index 0000000000000000000000000000000000000000..a6f809b10e29b03ed95aa6d6a7b39cabfcf6979f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/DfKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class DfKey + implements Identifier { + private static final long serialVersionUID = 4083286612161956839L; + private final String _id; + + + public DfKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public DfKey(DfKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DfKey)) { + return false; + } + final DfKey other = (DfKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(DfKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ElementGroup.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ElementGroup.java new file mode 100644 index 0000000000000000000000000000000000000000..b3c0bf4f74b32cf6483c113b76940b5dd56c66c0 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ElementGroup.java @@ -0,0 +1,105 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes the associated elements of a VNFD for a certain purpose during VNF + * lifecycle management. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list element-group {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   leaf-list vdu {
+ *     type leafref {
+ *       path ../../vdu/id;
+ *     }
+ *   }
+ *   leaf-list virtual-link-desc {
+ *     type leafref {
+ *       path ../../int-virtual-link-desc/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/element-group + * + *

To create instances of this class use {@link ElementGroupBuilder}. + * @see ElementGroupBuilder + * @see ElementGroupKey + * + */ +public interface ElementGroup + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("element-group"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ElementGroup.class; + } + + /** + * Unique identifier of this group in the VNFD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Human readable description of the group. + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * References to Vdus that are part of this group. + * + * + * + * @return java.util.List vdu, or null if not present + */ + @Nullable List getVdu(); + + /** + * References to VnfVirtualLinkDesc that are part of this group. + * + * + * + * @return java.util.List virtualLinkDesc, or null if not present + */ + @Nullable List getVirtualLinkDesc(); + + @Override + ElementGroupKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ElementGroupBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ElementGroupBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..7532bbfe52c04ccd274100f602192e113e7d3ad1 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ElementGroupBuilder.java @@ -0,0 +1,318 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ElementGroupBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ElementGroupBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ElementGroupBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ElementGroupBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ElementGroupBuilder + * @see Builder + * + */ +public class ElementGroupBuilder implements Builder { + + private String _description; + private String _id; + private List _vdu; + private List _virtualLinkDesc; + private ElementGroupKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ElementGroupBuilder() { + } + + public ElementGroupBuilder(ElementGroup base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._description = base.getDescription(); + this._vdu = base.getVdu(); + this._virtualLinkDesc = base.getVirtualLinkDesc(); + } + + + public ElementGroupKey key() { + return key; + } + + public String getDescription() { + return _description; + } + + public String getId() { + return _id; + } + + public List getVdu() { + return _vdu; + } + + public List getVirtualLinkDesc() { + return _virtualLinkDesc; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ElementGroupBuilder withKey(final ElementGroupKey key) { + this.key = key; + return this; + } + + public ElementGroupBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public ElementGroupBuilder setId(final String value) { + this._id = value; + return this; + } + public ElementGroupBuilder setVdu(final List values) { + this._vdu = values; + return this; + } + + public ElementGroupBuilder setVirtualLinkDesc(final List values) { + this._virtualLinkDesc = values; + return this; + } + + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ElementGroupBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ElementGroupBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ElementGroupBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ElementGroupBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ElementGroup build() { + return new ElementGroupImpl(this); + } + + private static final class ElementGroupImpl + extends AbstractAugmentable + implements ElementGroup { + + private final String _description; + private final String _id; + private final List _vdu; + private final List _virtualLinkDesc; + private final ElementGroupKey key; + + ElementGroupImpl(ElementGroupBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ElementGroupKey(base.getId()); + } + this._id = key.getId(); + this._description = base.getDescription(); + this._vdu = base.getVdu(); + this._virtualLinkDesc = base.getVirtualLinkDesc(); + } + + @Override + public ElementGroupKey key() { + return key; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public String getId() { + return _id; + } + + @Override + public List getVdu() { + return _vdu; + } + + @Override + public List getVirtualLinkDesc() { + return _virtualLinkDesc; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_vdu); + result = prime * result + Objects.hashCode(_virtualLinkDesc); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ElementGroup.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ElementGroup other = (ElementGroup)obj; + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_vdu, other.getVdu())) { + return false; + } + if (!Objects.equals(_virtualLinkDesc, other.getVirtualLinkDesc())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ElementGroupImpl otherImpl = (ElementGroupImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ElementGroup"); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_vdu", _vdu); + CodeHelpers.appendValue(helper, "_virtualLinkDesc", _virtualLinkDesc); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ElementGroupKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ElementGroupKey.java new file mode 100644 index 0000000000000000000000000000000000000000..8fce70316a37208107f0c5f5aa7b7c4fd694f678 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ElementGroupKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ElementGroupKey + implements Identifier { + private static final long serialVersionUID = 5183248186865619279L; + private final String _id; + + + public ElementGroupKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ElementGroupKey(ElementGroupKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ElementGroupKey)) { + return false; + } + final ElementGroupKey other = (ElementGroupKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ElementGroupKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ExtCpd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ExtCpd.java new file mode 100644 index 0000000000000000000000000000000000000000..eaf1c41cd4e6c6cae2f13418d6caebe0b1986f9a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ExtCpd.java @@ -0,0 +1,123 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.CpConnection; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes an external interface exposed by this VNF enabling connection with a + * Virual Link + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list ext-cpd {
+ *   key id;
+ *   min-elements 1;
+ *   choice cp-connection {
+ *     case int-virtual-link-desc {
+ *       leaf int-virtual-link-desc {
+ *         type leafref {
+ *           path ../../int-virtual-link-desc/id;
+ *         }
+ *       }
+ *     }
+ *     case int-cpd {
+ *       container int-cpd {
+ *         leaf vdu-id {
+ *           type leafref {
+ *             path ../../../vdu/id;
+ *           }
+ *         }
+ *         leaf cpd {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *     case k8s-cluster-net {
+ *       leaf k8s-cluster-net {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   uses virtual-network-interface-requirements;
+ *   leaf nicio-requirements {
+ *     type leafref {
+ *       path ../../virtual-compute-desc/id;
+ *     }
+ *   }
+ *   uses cpd;
+ *   leaf security-group-rule-id {
+ *     type leafref {
+ *       path ../../security-group-rule/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/ext-cpd + * + *

To create instances of this class use {@link ExtCpdBuilder}. + * @see ExtCpdBuilder + * @see ExtCpdKey + * + */ +public interface ExtCpd + extends + ChildOf, + Augmentable, + VirtualNetworkInterfaceRequirements, + Cpd, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ext-cpd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ExtCpd.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.CpConnection cpConnection, or null if not present + */ + @Nullable CpConnection getCpConnection(); + + /** + * This references (couples) the CPD with any logical node I/O requirements (for + * network devices) that may have been created. Linking these attributes is + * necessary so that so that I/O requirements that need to be articulated at the + * logical node level can be associated with the network interface requirements + * associated with the CPD. + * + * + * + * @return java.lang.String nicioRequirements, or null if not present + */ + @Nullable String getNicioRequirements(); + + /** + * Reference of the security group rules bound to this CPD. + * + * + * + * @return java.lang.String securityGroupRuleId, or null if not present + */ + @Nullable String getSecurityGroupRuleId(); + + @Override + ExtCpdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ExtCpdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ExtCpdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..2c51e4685859d055e69feea8b227bb3af5ce23f6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ExtCpdBuilder.java @@ -0,0 +1,536 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.CpRole; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.Protocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.ProtocolKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.VirtualNetworkInterfaceRequirement; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.VirtualNetworkInterfaceRequirementKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.CpConnection; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ExtCpdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ExtCpdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ExtCpdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ExtCpdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ExtCpdBuilder + * @see Builder + * + */ +public class ExtCpdBuilder implements Builder { + + private CpConnection _cpConnection; + private String _description; + private String _id; + private List> _layerProtocol; + private String _nicioRequirements; + private Map _protocol; + private Class _role; + private String _securityGroupRuleId; + private Map _virtualNetworkInterfaceRequirement; + private Boolean _trunkMode; + private ExtCpdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ExtCpdBuilder() { + } + public ExtCpdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements arg) { + this._virtualNetworkInterfaceRequirement = arg.getVirtualNetworkInterfaceRequirement(); + } + public ExtCpdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd arg) { + this._id = arg.getId(); + this._layerProtocol = arg.getLayerProtocol(); + this._role = arg.getRole(); + this._description = arg.getDescription(); + this._protocol = arg.getProtocol(); + this._trunkMode = arg.isTrunkMode(); + } + + public ExtCpdBuilder(ExtCpd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._cpConnection = base.getCpConnection(); + this._description = base.getDescription(); + this._layerProtocol = base.getLayerProtocol(); + this._nicioRequirements = base.getNicioRequirements(); + this._protocol = base.getProtocol(); + this._role = base.getRole(); + this._securityGroupRuleId = base.getSecurityGroupRuleId(); + this._virtualNetworkInterfaceRequirement = base.getVirtualNetworkInterfaceRequirement(); + this._trunkMode = base.isTrunkMode(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements) { + this._virtualNetworkInterfaceRequirement = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements)arg).getVirtualNetworkInterfaceRequirement(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd) { + this._id = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getId(); + this._layerProtocol = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getLayerProtocol(); + this._role = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getRole(); + this._description = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getDescription(); + this._protocol = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getProtocol(); + this._trunkMode = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).isTrunkMode(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements, org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd]"); + } + + public ExtCpdKey key() { + return key; + } + + public CpConnection getCpConnection() { + return _cpConnection; + } + + public String getDescription() { + return _description; + } + + public String getId() { + return _id; + } + + public List> getLayerProtocol() { + return _layerProtocol; + } + + public String getNicioRequirements() { + return _nicioRequirements; + } + + public Map getProtocol() { + return _protocol; + } + + public Class getRole() { + return _role; + } + + public String getSecurityGroupRuleId() { + return _securityGroupRuleId; + } + + public Map getVirtualNetworkInterfaceRequirement() { + return _virtualNetworkInterfaceRequirement; + } + + public Boolean isTrunkMode() { + return _trunkMode; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ExtCpdBuilder withKey(final ExtCpdKey key) { + this.key = key; + return this; + } + + public ExtCpdBuilder setCpConnection(final CpConnection value) { + this._cpConnection = value; + return this; + } + + public ExtCpdBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public ExtCpdBuilder setId(final String value) { + this._id = value; + return this; + } + public ExtCpdBuilder setLayerProtocol(final List> values) { + this._layerProtocol = values; + return this; + } + + + public ExtCpdBuilder setNicioRequirements(final String value) { + this._nicioRequirements = value; + return this; + } + public ExtCpdBuilder setProtocol(final Map values) { + this._protocol = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setProtocol(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ExtCpdBuilder setProtocol(final List values) { + return setProtocol(CodeHelpers.compatMap(values)); + } + + public ExtCpdBuilder setRole(final Class value) { + this._role = value; + return this; + } + + public ExtCpdBuilder setSecurityGroupRuleId(final String value) { + this._securityGroupRuleId = value; + return this; + } + public ExtCpdBuilder setVirtualNetworkInterfaceRequirement(final Map values) { + this._virtualNetworkInterfaceRequirement = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualNetworkInterfaceRequirement(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ExtCpdBuilder setVirtualNetworkInterfaceRequirement(final List values) { + return setVirtualNetworkInterfaceRequirement(CodeHelpers.compatMap(values)); + } + + public ExtCpdBuilder setTrunkMode(final Boolean value) { + this._trunkMode = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ExtCpdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ExtCpdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ExtCpdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ExtCpdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ExtCpd build() { + return new ExtCpdImpl(this); + } + + private static final class ExtCpdImpl + extends AbstractAugmentable + implements ExtCpd { + + private final CpConnection _cpConnection; + private final String _description; + private final String _id; + private final List> _layerProtocol; + private final String _nicioRequirements; + private final Map _protocol; + private final Class _role; + private final String _securityGroupRuleId; + private final Map _virtualNetworkInterfaceRequirement; + private final Boolean _trunkMode; + private final ExtCpdKey key; + + ExtCpdImpl(ExtCpdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ExtCpdKey(base.getId()); + } + this._id = key.getId(); + this._cpConnection = base.getCpConnection(); + this._description = base.getDescription(); + this._layerProtocol = base.getLayerProtocol(); + this._nicioRequirements = base.getNicioRequirements(); + this._protocol = CodeHelpers.emptyToNull(base.getProtocol()); + this._role = base.getRole(); + this._securityGroupRuleId = base.getSecurityGroupRuleId(); + this._virtualNetworkInterfaceRequirement = CodeHelpers.emptyToNull(base.getVirtualNetworkInterfaceRequirement()); + this._trunkMode = base.isTrunkMode(); + } + + @Override + public ExtCpdKey key() { + return key; + } + + @Override + public CpConnection getCpConnection() { + return _cpConnection; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public String getId() { + return _id; + } + + @Override + public List> getLayerProtocol() { + return _layerProtocol; + } + + @Override + public String getNicioRequirements() { + return _nicioRequirements; + } + + @Override + public Map getProtocol() { + return _protocol; + } + + @Override + public Class getRole() { + return _role; + } + + @Override + public String getSecurityGroupRuleId() { + return _securityGroupRuleId; + } + + @Override + public Map getVirtualNetworkInterfaceRequirement() { + return _virtualNetworkInterfaceRequirement; + } + + @Override + public Boolean isTrunkMode() { + return _trunkMode; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cpConnection); + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_layerProtocol); + result = prime * result + Objects.hashCode(_nicioRequirements); + result = prime * result + Objects.hashCode(_protocol); + result = prime * result + Objects.hashCode(_role); + result = prime * result + Objects.hashCode(_securityGroupRuleId); + result = prime * result + Objects.hashCode(_virtualNetworkInterfaceRequirement); + result = prime * result + Objects.hashCode(_trunkMode); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ExtCpd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ExtCpd other = (ExtCpd)obj; + if (!Objects.equals(_cpConnection, other.getCpConnection())) { + return false; + } + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_layerProtocol, other.getLayerProtocol())) { + return false; + } + if (!Objects.equals(_nicioRequirements, other.getNicioRequirements())) { + return false; + } + if (!Objects.equals(_protocol, other.getProtocol())) { + return false; + } + if (!Objects.equals(_role, other.getRole())) { + return false; + } + if (!Objects.equals(_securityGroupRuleId, other.getSecurityGroupRuleId())) { + return false; + } + if (!Objects.equals(_virtualNetworkInterfaceRequirement, other.getVirtualNetworkInterfaceRequirement())) { + return false; + } + if (!Objects.equals(_trunkMode, other.isTrunkMode())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ExtCpdImpl otherImpl = (ExtCpdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ExtCpd"); + CodeHelpers.appendValue(helper, "_cpConnection", _cpConnection); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_layerProtocol", _layerProtocol); + CodeHelpers.appendValue(helper, "_nicioRequirements", _nicioRequirements); + CodeHelpers.appendValue(helper, "_protocol", _protocol); + CodeHelpers.appendValue(helper, "_role", _role); + CodeHelpers.appendValue(helper, "_securityGroupRuleId", _securityGroupRuleId); + CodeHelpers.appendValue(helper, "_virtualNetworkInterfaceRequirement", _virtualNetworkInterfaceRequirement); + CodeHelpers.appendValue(helper, "_trunkMode", _trunkMode); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ExtCpdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ExtCpdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..f0c2cd6f3ccec3a2c5d3603056a40b44b1463371 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ExtCpdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ExtCpdKey + implements Identifier { + private static final long serialVersionUID = -7160822752734312733L; + private final String _id; + + + public ExtCpdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ExtCpdKey(ExtCpdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ExtCpdKey)) { + return false; + } + final ExtCpdKey other = (ExtCpdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ExtCpdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/Indicator.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/Indicator.java new file mode 100644 index 0000000000000000000000000000000000000000..aa791a8a74612179b51bd0d3b342d807ecfcec53 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/Indicator.java @@ -0,0 +1,174 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Declares the VNF indicators that are supported by this VNF. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list indicator {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf-list indicator-value {
+ *     type string;
+ *   }
+ *   leaf source {
+ *     type enumeration {
+ *       enum vnf;
+ *       enum em;
+ *       enum both;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/indicator + * + *

To create instances of this class use {@link IndicatorBuilder}. + * @see IndicatorBuilder + * @see IndicatorKey + * + */ +public interface Indicator + extends + ChildOf, + Augmentable, + Identifiable +{ + + + public enum Source implements Enumeration { + Vnf(0, "vnf"), + + Em(1, "em"), + + Both(2, "both") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (Source enumItem : Source.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private Source(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding Source item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding Source item, or null if no such item exists + */ + public static Source forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("indicator"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Indicator.class; + } + + /** + * Unique identifier + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * The human readable name of the VnfIndicator. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Defines the allowed values or value ranges of this indicator. + * + * + * + * @return java.util.List indicatorValue, or null if not present + */ + @Nullable List getIndicatorValue(); + + /** + * Describe the source of the indicator. The possible values are: • VNF. • EM. • + * Both. This tells the consumer where to send the subscription request. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Indicator.Source source, or null if not present + */ + @Nullable Source getSource(); + + @Override + IndicatorKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IndicatorBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IndicatorBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..723f22e7815c590b149957de05bb02499cb631a1 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IndicatorBuilder.java @@ -0,0 +1,318 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link IndicatorBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     IndicatorBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new IndicatorBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of IndicatorBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see IndicatorBuilder + * @see Builder + * + */ +public class IndicatorBuilder implements Builder { + + private String _id; + private List _indicatorValue; + private String _name; + private Indicator.Source _source; + private IndicatorKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public IndicatorBuilder() { + } + + public IndicatorBuilder(Indicator base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._indicatorValue = base.getIndicatorValue(); + this._name = base.getName(); + this._source = base.getSource(); + } + + + public IndicatorKey key() { + return key; + } + + public String getId() { + return _id; + } + + public List getIndicatorValue() { + return _indicatorValue; + } + + public String getName() { + return _name; + } + + public Indicator.Source getSource() { + return _source; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public IndicatorBuilder withKey(final IndicatorKey key) { + this.key = key; + return this; + } + + public IndicatorBuilder setId(final String value) { + this._id = value; + return this; + } + public IndicatorBuilder setIndicatorValue(final List values) { + this._indicatorValue = values; + return this; + } + + + public IndicatorBuilder setName(final String value) { + this._name = value; + return this; + } + + public IndicatorBuilder setSource(final Indicator.Source value) { + this._source = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public IndicatorBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public IndicatorBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public IndicatorBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private IndicatorBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Indicator build() { + return new IndicatorImpl(this); + } + + private static final class IndicatorImpl + extends AbstractAugmentable + implements Indicator { + + private final String _id; + private final List _indicatorValue; + private final String _name; + private final Indicator.Source _source; + private final IndicatorKey key; + + IndicatorImpl(IndicatorBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new IndicatorKey(base.getId()); + } + this._id = key.getId(); + this._indicatorValue = base.getIndicatorValue(); + this._name = base.getName(); + this._source = base.getSource(); + } + + @Override + public IndicatorKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public List getIndicatorValue() { + return _indicatorValue; + } + + @Override + public String getName() { + return _name; + } + + @Override + public Indicator.Source getSource() { + return _source; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_indicatorValue); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_source); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Indicator.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Indicator other = (Indicator)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_indicatorValue, other.getIndicatorValue())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_source, other.getSource())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + IndicatorImpl otherImpl = (IndicatorImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Indicator"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_indicatorValue", _indicatorValue); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_source", _source); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IndicatorKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IndicatorKey.java new file mode 100644 index 0000000000000000000000000000000000000000..b48332eaca9e8ab65b011f9f1f021801288bc389 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IndicatorKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class IndicatorKey + implements Identifier { + private static final long serialVersionUID = 2687907149552019284L; + private final String _id; + + + public IndicatorKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public IndicatorKey(IndicatorKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof IndicatorKey)) { + return false; + } + final IndicatorKey other = (IndicatorKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(IndicatorKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IntVirtualLinkDesc.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IntVirtualLinkDesc.java new file mode 100644 index 0000000000000000000000000000000000000000..b4c14116ba1dca3cd4064cebc9b4a6e06bf9d8fb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IntVirtualLinkDesc.java @@ -0,0 +1,158 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.Flavour; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.FlavourKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.MonitoringParameters; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.MonitoringParametersKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Represents the type of network connectivity mandated by the VNF provider + * two or more CPs which includes at least one internal CP. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list int-virtual-link-desc {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   list flavour {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     container qos {
+ *       presence "VL QoS parameters";
+ *       leaf latency {
+ *         type uint32;
+ *         units ms;
+ *       }
+ *       leaf packet-delay-variation {
+ *         type uint32;
+ *         units ms;
+ *       }
+ *       leaf packet-loss-ratio {
+ *         type decimal64 {
+ *           fraction-digits 2;
+ *           range 0..1.00;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   uses connectivity-type;
+ *   leaf-list test-access {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   list monitoring-parameters {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     uses monitoring-parameter;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/int-virtual-link-desc + * + *

To create instances of this class use {@link IntVirtualLinkDescBuilder}. + * @see IntVirtualLinkDescBuilder + * @see IntVirtualLinkDescKey + * + */ +public interface IntVirtualLinkDesc + extends + ChildOf, + Augmentable, + ConnectivityType, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("int-virtual-link-desc"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IntVirtualLinkDesc.class; + } + + /** + * Unique identifier of this internal VLD in VNFD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Describes a specific flavour of the VL with specific bitrate requirements. + * + * + * + * @return java.util.Map flavour, or null if not present + */ + @Nullable Map getFlavour(); + + /** + * @return java.util.Map flavour, or an empty list if it is not present + */ + default @NonNull Map nonnullFlavour() { + return CodeHelpers.nonnull(getFlavour()); + } + + /** + * Specifies test access facilities expected on the VL (e.g. none, passive + * monitoring, or active (intrusive) loopbacks at endpoints. + * + * + * + * @return java.util.List testAccess, or null if not present + */ + @Nullable List getTestAccess(); + + /** + * Provides human-readable information on the purpose of the VL (e.g. control plane + * traffic). + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * @return java.util.Map monitoringParameters, or null if not present + */ + @Nullable Map getMonitoringParameters(); + + /** + * @return java.util.Map monitoringParameters, or an empty list if it is not present + */ + default @NonNull Map nonnullMonitoringParameters() { + return CodeHelpers.nonnull(getMonitoringParameters()); + } + + @Override + IntVirtualLinkDescKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IntVirtualLinkDescBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IntVirtualLinkDescBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..effaa682f6c0b91eeab207af82e9eab47103a00a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IntVirtualLinkDescBuilder.java @@ -0,0 +1,423 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.connectivity.type.ConnectivityType; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.Flavour; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.FlavourKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.MonitoringParameters; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.MonitoringParametersKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link IntVirtualLinkDescBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     IntVirtualLinkDescBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new IntVirtualLinkDescBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of IntVirtualLinkDescBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see IntVirtualLinkDescBuilder + * @see Builder + * + */ +public class IntVirtualLinkDescBuilder implements Builder { + + private ConnectivityType _connectivityType; + private String _description; + private Map _flavour; + private String _id; + private Map _monitoringParameters; + private List _testAccess; + private IntVirtualLinkDescKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public IntVirtualLinkDescBuilder() { + } + public IntVirtualLinkDescBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType arg) { + this._connectivityType = arg.getConnectivityType(); + } + + public IntVirtualLinkDescBuilder(IntVirtualLinkDesc base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._connectivityType = base.getConnectivityType(); + this._description = base.getDescription(); + this._flavour = base.getFlavour(); + this._monitoringParameters = base.getMonitoringParameters(); + this._testAccess = base.getTestAccess(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType) { + this._connectivityType = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType)arg).getConnectivityType(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ConnectivityType]"); + } + + public IntVirtualLinkDescKey key() { + return key; + } + + public ConnectivityType getConnectivityType() { + return _connectivityType; + } + + public String getDescription() { + return _description; + } + + public Map getFlavour() { + return _flavour; + } + + public String getId() { + return _id; + } + + public Map getMonitoringParameters() { + return _monitoringParameters; + } + + public List getTestAccess() { + return _testAccess; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public IntVirtualLinkDescBuilder withKey(final IntVirtualLinkDescKey key) { + this.key = key; + return this; + } + + public IntVirtualLinkDescBuilder setConnectivityType(final ConnectivityType value) { + this._connectivityType = value; + return this; + } + + public IntVirtualLinkDescBuilder setDescription(final String value) { + this._description = value; + return this; + } + public IntVirtualLinkDescBuilder setFlavour(final Map values) { + this._flavour = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setFlavour(Map)} instead. + */ + @Deprecated(forRemoval = true) + public IntVirtualLinkDescBuilder setFlavour(final List values) { + return setFlavour(CodeHelpers.compatMap(values)); + } + + public IntVirtualLinkDescBuilder setId(final String value) { + this._id = value; + return this; + } + public IntVirtualLinkDescBuilder setMonitoringParameters(final Map values) { + this._monitoringParameters = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setMonitoringParameters(Map)} instead. + */ + @Deprecated(forRemoval = true) + public IntVirtualLinkDescBuilder setMonitoringParameters(final List values) { + return setMonitoringParameters(CodeHelpers.compatMap(values)); + } + public IntVirtualLinkDescBuilder setTestAccess(final List values) { + this._testAccess = values; + return this; + } + + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public IntVirtualLinkDescBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public IntVirtualLinkDescBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public IntVirtualLinkDescBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private IntVirtualLinkDescBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public IntVirtualLinkDesc build() { + return new IntVirtualLinkDescImpl(this); + } + + private static final class IntVirtualLinkDescImpl + extends AbstractAugmentable + implements IntVirtualLinkDesc { + + private final ConnectivityType _connectivityType; + private final String _description; + private final Map _flavour; + private final String _id; + private final Map _monitoringParameters; + private final List _testAccess; + private final IntVirtualLinkDescKey key; + + IntVirtualLinkDescImpl(IntVirtualLinkDescBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new IntVirtualLinkDescKey(base.getId()); + } + this._id = key.getId(); + this._connectivityType = base.getConnectivityType(); + this._description = base.getDescription(); + this._flavour = CodeHelpers.emptyToNull(base.getFlavour()); + this._monitoringParameters = CodeHelpers.emptyToNull(base.getMonitoringParameters()); + this._testAccess = base.getTestAccess(); + } + + @Override + public IntVirtualLinkDescKey key() { + return key; + } + + @Override + public ConnectivityType getConnectivityType() { + return _connectivityType; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public Map getFlavour() { + return _flavour; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getMonitoringParameters() { + return _monitoringParameters; + } + + @Override + public List getTestAccess() { + return _testAccess; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_connectivityType); + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_flavour); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_monitoringParameters); + result = prime * result + Objects.hashCode(_testAccess); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!IntVirtualLinkDesc.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + IntVirtualLinkDesc other = (IntVirtualLinkDesc)obj; + if (!Objects.equals(_connectivityType, other.getConnectivityType())) { + return false; + } + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_flavour, other.getFlavour())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_monitoringParameters, other.getMonitoringParameters())) { + return false; + } + if (!Objects.equals(_testAccess, other.getTestAccess())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + IntVirtualLinkDescImpl otherImpl = (IntVirtualLinkDescImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("IntVirtualLinkDesc"); + CodeHelpers.appendValue(helper, "_connectivityType", _connectivityType); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_flavour", _flavour); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_monitoringParameters", _monitoringParameters); + CodeHelpers.appendValue(helper, "_testAccess", _testAccess); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IntVirtualLinkDescKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IntVirtualLinkDescKey.java new file mode 100644 index 0000000000000000000000000000000000000000..5b6d8c169c0a637567cafbed1294e60ab85bc7dc --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/IntVirtualLinkDescKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class IntVirtualLinkDescKey + implements Identifier { + private static final long serialVersionUID = 375821421458981131L; + private final String _id; + + + public IntVirtualLinkDescKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public IntVirtualLinkDescKey(IntVirtualLinkDescKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof IntVirtualLinkDescKey)) { + return false; + } + final IntVirtualLinkDescKey other = (IntVirtualLinkDescKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(IntVirtualLinkDescKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/LifecycleManagementScript.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/LifecycleManagementScript.java new file mode 100644 index 0000000000000000000000000000000000000000..35d11a3aba15737e6dcec0d7d7c6638c29bee7b8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/LifecycleManagementScript.java @@ -0,0 +1,149 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.InternalLifecycleManagementScriptEvent; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.lifecycle.management.script.ScriptInput; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.lifecycle.management.script.ScriptInputKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Includes a list of events and corresponding management scripts performed for + * VNF. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list lifecycle-management-script {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf-list event {
+ *     type internal-lifecycle-management-script-event;
+ *   }
+ *   leaf-list lcm-transition-event {
+ *     type string;
+ *   }
+ *   leaf script {
+ *     type string;
+ *   }
+ *   leaf script-dsl {
+ *     type string;
+ *   }
+ *   list script-input {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/lifecycle-management-script + * + *

To create instances of this class use {@link LifecycleManagementScriptBuilder}. + * @see LifecycleManagementScriptBuilder + * @see LifecycleManagementScriptKey + * + */ +public interface LifecycleManagementScript + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("lifecycle-management-script"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.LifecycleManagementScript.class; + } + + /** + * A unique string that identfies the script in question. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Describes VNF lifecycle event(s) or an external stimulus detected on a VNFM + * reference point. + * + * + * + * @return java.util.List event, or null if not present + */ + @Nullable List getEvent(); + + /** + * Describes the transition VNF lifecycle event(s) that cannot be mapped to any of + * the enumerated values defined for the event attribute. + * + * + * + * @return java.util.List lcmTransitionEvent, or null if not present + */ + @Nullable List getLcmTransitionEvent(); + + /** + * Includes a VNF LCM script (e.g. written in a DSL as specified in requirement + * VNF_PACK.LCM.001) triggered to react to one of the events listed in the event + * attribute. + * + * + * + * @return java.lang.String script, or null if not present + */ + @Nullable String getScript(); + + /** + * Defines the domain specific language (i.e. the type) of script that is provided. + * Types of scripts could include bash, python, etc. + * + * + * + * @return java.lang.String scriptDsl, or null if not present + */ + @Nullable String getScriptDsl(); + + /** + * Array of KVP requirements with the key as the parameter name and the value as + * the parameter that need to be passed as an input to the script. + * + * + * + * @return java.util.Map scriptInput, or null if not present + */ + @Nullable Map getScriptInput(); + + /** + * @return java.util.Map scriptInput, or an empty list if it is not present + */ + default @NonNull Map nonnullScriptInput() { + return CodeHelpers.nonnull(getScriptInput()); + } + + @Override + LifecycleManagementScriptKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/LifecycleManagementScriptBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/LifecycleManagementScriptBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..c283b8b1b24bc94695a903986a9dec5d498890aa --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/LifecycleManagementScriptBuilder.java @@ -0,0 +1,384 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.InternalLifecycleManagementScriptEvent; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.lifecycle.management.script.ScriptInput; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.lifecycle.management.script.ScriptInputKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link LifecycleManagementScriptBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     LifecycleManagementScriptBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new LifecycleManagementScriptBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of LifecycleManagementScriptBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see LifecycleManagementScriptBuilder + * @see Builder + * + */ +public class LifecycleManagementScriptBuilder implements Builder { + + private List _event; + private String _id; + private List _lcmTransitionEvent; + private String _script; + private String _scriptDsl; + private Map _scriptInput; + private LifecycleManagementScriptKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public LifecycleManagementScriptBuilder() { + } + + public LifecycleManagementScriptBuilder(LifecycleManagementScript base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._event = base.getEvent(); + this._lcmTransitionEvent = base.getLcmTransitionEvent(); + this._script = base.getScript(); + this._scriptDsl = base.getScriptDsl(); + this._scriptInput = base.getScriptInput(); + } + + + public LifecycleManagementScriptKey key() { + return key; + } + + public List getEvent() { + return _event; + } + + public String getId() { + return _id; + } + + public List getLcmTransitionEvent() { + return _lcmTransitionEvent; + } + + public String getScript() { + return _script; + } + + public String getScriptDsl() { + return _scriptDsl; + } + + public Map getScriptInput() { + return _scriptInput; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public LifecycleManagementScriptBuilder withKey(final LifecycleManagementScriptKey key) { + this.key = key; + return this; + } + public LifecycleManagementScriptBuilder setEvent(final List values) { + this._event = values; + return this; + } + + + public LifecycleManagementScriptBuilder setId(final String value) { + this._id = value; + return this; + } + public LifecycleManagementScriptBuilder setLcmTransitionEvent(final List values) { + this._lcmTransitionEvent = values; + return this; + } + + + public LifecycleManagementScriptBuilder setScript(final String value) { + this._script = value; + return this; + } + + public LifecycleManagementScriptBuilder setScriptDsl(final String value) { + this._scriptDsl = value; + return this; + } + public LifecycleManagementScriptBuilder setScriptInput(final Map values) { + this._scriptInput = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setScriptInput(Map)} instead. + */ + @Deprecated(forRemoval = true) + public LifecycleManagementScriptBuilder setScriptInput(final List values) { + return setScriptInput(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public LifecycleManagementScriptBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public LifecycleManagementScriptBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public LifecycleManagementScriptBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private LifecycleManagementScriptBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public LifecycleManagementScript build() { + return new LifecycleManagementScriptImpl(this); + } + + private static final class LifecycleManagementScriptImpl + extends AbstractAugmentable + implements LifecycleManagementScript { + + private final List _event; + private final String _id; + private final List _lcmTransitionEvent; + private final String _script; + private final String _scriptDsl; + private final Map _scriptInput; + private final LifecycleManagementScriptKey key; + + LifecycleManagementScriptImpl(LifecycleManagementScriptBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new LifecycleManagementScriptKey(base.getId()); + } + this._id = key.getId(); + this._event = base.getEvent(); + this._lcmTransitionEvent = base.getLcmTransitionEvent(); + this._script = base.getScript(); + this._scriptDsl = base.getScriptDsl(); + this._scriptInput = CodeHelpers.emptyToNull(base.getScriptInput()); + } + + @Override + public LifecycleManagementScriptKey key() { + return key; + } + + @Override + public List getEvent() { + return _event; + } + + @Override + public String getId() { + return _id; + } + + @Override + public List getLcmTransitionEvent() { + return _lcmTransitionEvent; + } + + @Override + public String getScript() { + return _script; + } + + @Override + public String getScriptDsl() { + return _scriptDsl; + } + + @Override + public Map getScriptInput() { + return _scriptInput; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_event); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_lcmTransitionEvent); + result = prime * result + Objects.hashCode(_script); + result = prime * result + Objects.hashCode(_scriptDsl); + result = prime * result + Objects.hashCode(_scriptInput); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!LifecycleManagementScript.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + LifecycleManagementScript other = (LifecycleManagementScript)obj; + if (!Objects.equals(_event, other.getEvent())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_lcmTransitionEvent, other.getLcmTransitionEvent())) { + return false; + } + if (!Objects.equals(_script, other.getScript())) { + return false; + } + if (!Objects.equals(_scriptDsl, other.getScriptDsl())) { + return false; + } + if (!Objects.equals(_scriptInput, other.getScriptInput())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + LifecycleManagementScriptImpl otherImpl = (LifecycleManagementScriptImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("LifecycleManagementScript"); + CodeHelpers.appendValue(helper, "_event", _event); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_lcmTransitionEvent", _lcmTransitionEvent); + CodeHelpers.appendValue(helper, "_script", _script); + CodeHelpers.appendValue(helper, "_scriptDsl", _scriptDsl); + CodeHelpers.appendValue(helper, "_scriptInput", _scriptInput); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/LifecycleManagementScriptKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/LifecycleManagementScriptKey.java new file mode 100644 index 0000000000000000000000000000000000000000..7879329a1d485d36ed9bf1dbd293ad21de1ce6f0 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/LifecycleManagementScriptKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class LifecycleManagementScriptKey + implements Identifier { + private static final long serialVersionUID = 4840233266810285534L; + private final String _id; + + + public LifecycleManagementScriptKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public LifecycleManagementScriptKey(LifecycleManagementScriptKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof LifecycleManagementScriptKey)) { + return false; + } + final LifecycleManagementScriptKey other = (LifecycleManagementScriptKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(LifecycleManagementScriptKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ModifiableAttributes.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ModifiableAttributes.java new file mode 100644 index 0000000000000000000000000000000000000000..7b0ce04e9b65a52668882702a30155bcd6f598cf --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ModifiableAttributes.java @@ -0,0 +1,84 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes the modifiable attributes of the VNF. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container modifiable-attributes {
+ *   leaf-list extension {
+ *     type string;
+ *   }
+ *   leaf-list metadata {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/modifiable-attributes + * + *

To create instances of this class use {@link ModifiableAttributesBuilder}. + * @see ModifiableAttributesBuilder + * + */ +public interface ModifiableAttributes + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("modifiable-attributes"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ModifiableAttributes.class; + } + + /** + * Additional VNF-specific attributes of VnfInfo that affect the lifecycle + * management of a VNF instance and that are writeable. For each VNF instance, + * these attributes are stored persistently by the VNFM and can be queried and + * modified through the VNFM. These attributes are intended to be consumed by the + * VNFM or by the lifecycle management scripts during the execution of VNF + * lifecycle management operations. Modifying these values has no direct effect on + * the VNF instance; however, modified values can be considered during subsequent + * VNF lifecycle management operations, which means that the modified values can + * indirectly affect the configuration of the VNF instance. + * + * + * + * @return java.util.List extension, or null if not present + */ + @Nullable List getExtension(); + + /** + * Additional VNF-specific attributes of VnfInfo that are writeable and that + * provide metadata describing the VNF instance. For each VNF instance, these + * attributes are stored persistently by the VNFM and can be queried and modified + * through the VNFM. These attributes are intended to provide information to + * functional blocks external to the VNFM and will not be used by the VNFM or the + * VNF lifecycle management scripts when executing lifecycle management operations. + * Modifying these attributes has no effect on the VNF instance. It only affects + * the attribute values stored by the VNFM. + * + * + * + * @return java.util.List metadata, or null if not present + */ + @Nullable List getMetadata(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ModifiableAttributesBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ModifiableAttributesBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..bf9d4e5297fc058eb8971b23004dd9d11688b96e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ModifiableAttributesBuilder.java @@ -0,0 +1,251 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ModifiableAttributesBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ModifiableAttributesBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ModifiableAttributesBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ModifiableAttributesBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ModifiableAttributesBuilder + * @see Builder + * + */ +public class ModifiableAttributesBuilder implements Builder { + + private List _extension; + private List _metadata; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ModifiableAttributesBuilder() { + } + + public ModifiableAttributesBuilder(ModifiableAttributes base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._extension = base.getExtension(); + this._metadata = base.getMetadata(); + } + + + public List getExtension() { + return _extension; + } + + public List getMetadata() { + return _metadata; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ModifiableAttributesBuilder setExtension(final List values) { + this._extension = values; + return this; + } + + public ModifiableAttributesBuilder setMetadata(final List values) { + this._metadata = values; + return this; + } + + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ModifiableAttributesBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ModifiableAttributesBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ModifiableAttributesBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ModifiableAttributesBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ModifiableAttributes build() { + return new ModifiableAttributesImpl(this); + } + + private static final class ModifiableAttributesImpl + extends AbstractAugmentable + implements ModifiableAttributes { + + private final List _extension; + private final List _metadata; + + ModifiableAttributesImpl(ModifiableAttributesBuilder base) { + super(base.augmentation); + this._extension = base.getExtension(); + this._metadata = base.getMetadata(); + } + + @Override + public List getExtension() { + return _extension; + } + + @Override + public List getMetadata() { + return _metadata; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_extension); + result = prime * result + Objects.hashCode(_metadata); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ModifiableAttributes.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ModifiableAttributes other = (ModifiableAttributes)obj; + if (!Objects.equals(_extension, other.getExtension())) { + return false; + } + if (!Objects.equals(_metadata, other.getMetadata())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ModifiableAttributesImpl otherImpl = (ModifiableAttributesImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ModifiableAttributes"); + CodeHelpers.appendValue(helper, "_extension", _extension); + CodeHelpers.appendValue(helper, "_metadata", _metadata); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/SwImageDesc.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/SwImageDesc.java new file mode 100644 index 0000000000000000000000000000000000000000..eedb26111e25160353ce364c7d4a696ef0e5e2ff --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/SwImageDesc.java @@ -0,0 +1,487 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.sw.image.desc.Checksum; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Defines descriptors of software images to be used by the VNF. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list sw-image-desc {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf version {
+ *     type string;
+ *   }
+ *   container checksum {
+ *     leaf algorithm {
+ *       type identityref {
+ *         base checksum-algorithm;
+ *       }
+ *     }
+ *     leaf hash {
+ *       type string;
+ *     }
+ *   }
+ *   leaf container-format {
+ *     default bare;
+ *     type enumeration {
+ *       enum aki {
+ *       }
+ *       enum ami {
+ *       }
+ *       enum ari {
+ *       }
+ *       enum bare {
+ *       }
+ *       enum docker {
+ *       }
+ *       enum ova {
+ *       }
+ *       enum ovf {
+ *       }
+ *     }
+ *   }
+ *   leaf disk-format {
+ *     default qcow2;
+ *     type enumeration {
+ *       enum aki {
+ *       }
+ *       enum ami {
+ *       }
+ *       enum ari {
+ *       }
+ *       enum iso {
+ *       }
+ *       enum qcow2 {
+ *       }
+ *       enum raw {
+ *       }
+ *       enum vdi {
+ *       }
+ *       enum vhd {
+ *       }
+ *       enum vhdx {
+ *       }
+ *       enum vmdk {
+ *       }
+ *     }
+ *   }
+ *   leaf min-disk {
+ *     type uint64;
+ *     units GB;
+ *   }
+ *   leaf min-ram {
+ *     type decimal64 {
+ *       fraction-digits 1;
+ *       range 0..max;
+ *     }
+ *     units GB;
+ *     default 0;
+ *   }
+ *   leaf size {
+ *     type uint64;
+ *     units GB;
+ *   }
+ *   leaf image {
+ *     default .;
+ *     type inet:uri;
+ *   }
+ *   leaf operating-system {
+ *     type string;
+ *   }
+ *   leaf-list supported-virtualization-environment {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/sw-image-desc + * + *

To create instances of this class use {@link SwImageDescBuilder}. + * @see SwImageDescBuilder + * @see SwImageDescKey + * + */ +public interface SwImageDesc + extends + ChildOf, + Augmentable, + Identifiable +{ + + + public enum ContainerFormat implements Enumeration { + /** + * An Amazon kernel image. + * + */ + Aki(0, "aki"), + + /** + * An Amazon machine image. + * + */ + Ami(1, "ami"), + + /** + * An Amazon ramdisk image. + * + */ + Ari(2, "ari"), + + /** + * The image does not have a container or metadata envelope. + * + */ + Bare(3, "bare"), + + /** + * A docker container format. + * + */ + Docker(4, "docker"), + + /** + * An OVF package in a tarfile. + * + */ + Ova(5, "ova"), + + /** + * The OVF container format. + * + */ + Ovf(6, "ovf") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (ContainerFormat enumItem : ContainerFormat.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private ContainerFormat(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding ContainerFormat item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding ContainerFormat item, or null if no such item exists + */ + public static ContainerFormat forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public enum DiskFormat implements Enumeration { + /** + * An Amazon kernel image. + * + */ + Aki(0, "aki"), + + /** + * An Amazon machine image. + * + */ + Ami(1, "ami"), + + /** + * An Amazon ramdisk image. + * + */ + Ari(2, "ari"), + + /** + * An archive format for the data contents of an disk, such as CD-ROM. + * + */ + Iso(3, "iso"), + + /** + * Supported by the QEMU emulator that can expand dynamically and supports Copy on + * Write. + * + */ + Qcow2(4, "qcow2"), + + /** + * An unstructured disk image format; if you have a file without an extension it is + * possibly a raw format. + * + */ + Raw(5, "raw"), + + /** + * Supported by VirtualBox virtual machine monitor and the QEMU emulator. + * + */ + Vdi(6, "vdi"), + + /** + * The VHD disk format, a common disk format used by virtual machine monitors from + * VMware, Xen, Microsoft, VirtualBox, and others. + * + */ + Vhd(7, "vhd"), + + /** + * The VHDX disk format, an enhanced version of the VHD format, which supports + * larger disk sizes among other features. + * + */ + Vhdx(8, "vhdx"), + + /** + * Common disk format supported by many common virtual machine monitors. + * + */ + Vmdk(9, "vmdk") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (DiskFormat enumItem : DiskFormat.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private DiskFormat(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding DiskFormat item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding DiskFormat item, or null if no such item exists + */ + public static DiskFormat forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("sw-image-desc"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDesc.class; + } + + /** + * The identifier of this software image. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * The name of this software image. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * The version of this software image. + * + * + * + * @return java.lang.String version, or null if not present + */ + @Nullable String getVersion(); + + /** + * The checksum of the software image file. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.sw.image.desc.Checksum checksum, or null if not present + */ + @Nullable Checksum getChecksum(); + + /** + * The container format describes the container file format in which software image + * is provided. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDesc.ContainerFormat containerFormat, or null if not present + */ + @Nullable ContainerFormat getContainerFormat(); + + /** + * The disk format of a software image is the format of the underlying disk image. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDesc.DiskFormat diskFormat, or null if not present + */ + @Nullable DiskFormat getDiskFormat(); + + /** + * The minimal disk size requirement for this software image. The value of the + * 'size of storage' attribute of the VirtualStorageDesc referencing this + * SwImageDesc shall not be smaller than the value of minDisk. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 minDisk, or null if not present + */ + @Nullable Uint64 getMinDisk(); + + /** + * The minimal RAM requirement for this software image. The value of the 'size' + * attribute of VirtualMemoryData of the Vdu referencing this SwImageDesc shall not + * be smaller than the value of minRam. + * + * + * + * @return java.math.BigDecimal minRam, or null if not present + */ + @Nullable BigDecimal getMinRam(); + + /** + * The size of this software image. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 size, or null if not present + */ + @Nullable Uint64 getSize(); + + /** + * This is a reference to the actual software image. The reference can be relative + * to the root of the VNF Package or can be a URL + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri image, or null if not present + */ + @Nullable Uri getImage(); + + /** + * Identifies the operating system used in the software image. This attribute may + * also identify if a 32 bit or 64 bit software image is used. + * + * + * + * @return java.lang.String operatingSystem, or null if not present + */ + @Nullable String getOperatingSystem(); + + /** + * Identifies the virtualisation environments (e.g. hypervisor) compatible with + * this software image. + * + * + * + * @return java.util.List supportedVirtualizationEnvironment, or null if not present + */ + @Nullable List getSupportedVirtualizationEnvironment(); + + @Override + SwImageDescKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/SwImageDescBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/SwImageDescBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..da0cae85a4c01e8e9799baf9e3e4118aa40b7c0c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/SwImageDescBuilder.java @@ -0,0 +1,553 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import com.google.common.collect.Range; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.lang.reflect.Array; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.sw.image.desc.Checksum; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link SwImageDescBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     SwImageDescBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new SwImageDescBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of SwImageDescBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see SwImageDescBuilder + * @see Builder + * + */ +public class SwImageDescBuilder implements Builder { + + private Checksum _checksum; + private SwImageDesc.ContainerFormat _containerFormat; + private SwImageDesc.DiskFormat _diskFormat; + private String _id; + private Uri _image; + private Uint64 _minDisk; + private BigDecimal _minRam; + private String _name; + private String _operatingSystem; + private Uint64 _size; + private List _supportedVirtualizationEnvironment; + private String _version; + private SwImageDescKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public SwImageDescBuilder() { + } + + public SwImageDescBuilder(SwImageDesc base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._checksum = base.getChecksum(); + this._containerFormat = base.getContainerFormat(); + this._diskFormat = base.getDiskFormat(); + this._image = base.getImage(); + this._minDisk = base.getMinDisk(); + this._minRam = base.getMinRam(); + this._name = base.getName(); + this._operatingSystem = base.getOperatingSystem(); + this._size = base.getSize(); + this._supportedVirtualizationEnvironment = base.getSupportedVirtualizationEnvironment(); + this._version = base.getVersion(); + } + + + public SwImageDescKey key() { + return key; + } + + public Checksum getChecksum() { + return _checksum; + } + + public SwImageDesc.ContainerFormat getContainerFormat() { + return _containerFormat; + } + + public SwImageDesc.DiskFormat getDiskFormat() { + return _diskFormat; + } + + public String getId() { + return _id; + } + + public Uri getImage() { + return _image; + } + + public Uint64 getMinDisk() { + return _minDisk; + } + + public BigDecimal getMinRam() { + return _minRam; + } + + public String getName() { + return _name; + } + + public String getOperatingSystem() { + return _operatingSystem; + } + + public Uint64 getSize() { + return _size; + } + + public List getSupportedVirtualizationEnvironment() { + return _supportedVirtualizationEnvironment; + } + + public String getVersion() { + return _version; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public SwImageDescBuilder withKey(final SwImageDescKey key) { + this.key = key; + return this; + } + + public SwImageDescBuilder setChecksum(final Checksum value) { + this._checksum = value; + return this; + } + + public SwImageDescBuilder setContainerFormat(final SwImageDesc.ContainerFormat value) { + this._containerFormat = value; + return this; + } + + public SwImageDescBuilder setDiskFormat(final SwImageDesc.DiskFormat value) { + this._diskFormat = value; + return this; + } + + public SwImageDescBuilder setId(final String value) { + this._id = value; + return this; + } + + public SwImageDescBuilder setImage(final Uri value) { + this._image = value; + return this; + } + + public SwImageDescBuilder setMinDisk(final Uint64 value) { + this._minDisk = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setMinDisk(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public SwImageDescBuilder setMinDisk(final BigInteger value) { + return setMinDisk(CodeHelpers.compatUint(value)); + } + + private static final Range[] CHECKMINRAMRANGE_RANGES; + static { + @SuppressWarnings("unchecked") + final Range[] a = (Range[]) Array.newInstance(Range.class, 1); + a[0] = Range.closed(java.math.BigDecimal.ZERO, new java.math.BigDecimal("922337203685477580.7")); + CHECKMINRAMRANGE_RANGES = a; + } + private static void checkMinRamRange(final java.math.BigDecimal value) { + for (Range r : CHECKMINRAMRANGE_RANGES) { + if (r.contains(value)) { + return; + } + } + CodeHelpers.throwInvalidRange(CHECKMINRAMRANGE_RANGES, value); + } + + public SwImageDescBuilder setMinRam(final BigDecimal value) { + if (value != null) { + checkMinRamRange(value); + + } + this._minRam = value; + return this; + } + + public SwImageDescBuilder setName(final String value) { + this._name = value; + return this; + } + + public SwImageDescBuilder setOperatingSystem(final String value) { + this._operatingSystem = value; + return this; + } + + public SwImageDescBuilder setSize(final Uint64 value) { + this._size = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setSize(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public SwImageDescBuilder setSize(final BigInteger value) { + return setSize(CodeHelpers.compatUint(value)); + } + public SwImageDescBuilder setSupportedVirtualizationEnvironment(final List values) { + this._supportedVirtualizationEnvironment = values; + return this; + } + + + public SwImageDescBuilder setVersion(final String value) { + this._version = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public SwImageDescBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public SwImageDescBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public SwImageDescBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private SwImageDescBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public SwImageDesc build() { + return new SwImageDescImpl(this); + } + + private static final class SwImageDescImpl + extends AbstractAugmentable + implements SwImageDesc { + + private final Checksum _checksum; + private final SwImageDesc.ContainerFormat _containerFormat; + private final SwImageDesc.DiskFormat _diskFormat; + private final String _id; + private final Uri _image; + private final Uint64 _minDisk; + private final BigDecimal _minRam; + private final String _name; + private final String _operatingSystem; + private final Uint64 _size; + private final List _supportedVirtualizationEnvironment; + private final String _version; + private final SwImageDescKey key; + + SwImageDescImpl(SwImageDescBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new SwImageDescKey(base.getId()); + } + this._id = key.getId(); + this._checksum = base.getChecksum(); + this._containerFormat = base.getContainerFormat(); + this._diskFormat = base.getDiskFormat(); + this._image = base.getImage(); + this._minDisk = base.getMinDisk(); + this._minRam = base.getMinRam(); + this._name = base.getName(); + this._operatingSystem = base.getOperatingSystem(); + this._size = base.getSize(); + this._supportedVirtualizationEnvironment = base.getSupportedVirtualizationEnvironment(); + this._version = base.getVersion(); + } + + @Override + public SwImageDescKey key() { + return key; + } + + @Override + public Checksum getChecksum() { + return _checksum; + } + + @Override + public SwImageDesc.ContainerFormat getContainerFormat() { + return _containerFormat; + } + + @Override + public SwImageDesc.DiskFormat getDiskFormat() { + return _diskFormat; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Uri getImage() { + return _image; + } + + @Override + public Uint64 getMinDisk() { + return _minDisk; + } + + @Override + public BigDecimal getMinRam() { + return _minRam; + } + + @Override + public String getName() { + return _name; + } + + @Override + public String getOperatingSystem() { + return _operatingSystem; + } + + @Override + public Uint64 getSize() { + return _size; + } + + @Override + public List getSupportedVirtualizationEnvironment() { + return _supportedVirtualizationEnvironment; + } + + @Override + public String getVersion() { + return _version; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_checksum); + result = prime * result + Objects.hashCode(_containerFormat); + result = prime * result + Objects.hashCode(_diskFormat); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_image); + result = prime * result + Objects.hashCode(_minDisk); + result = prime * result + Objects.hashCode(_minRam); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_operatingSystem); + result = prime * result + Objects.hashCode(_size); + result = prime * result + Objects.hashCode(_supportedVirtualizationEnvironment); + result = prime * result + Objects.hashCode(_version); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!SwImageDesc.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + SwImageDesc other = (SwImageDesc)obj; + if (!Objects.equals(_checksum, other.getChecksum())) { + return false; + } + if (!Objects.equals(_containerFormat, other.getContainerFormat())) { + return false; + } + if (!Objects.equals(_diskFormat, other.getDiskFormat())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_image, other.getImage())) { + return false; + } + if (!Objects.equals(_minDisk, other.getMinDisk())) { + return false; + } + if (!Objects.equals(_minRam, other.getMinRam())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_operatingSystem, other.getOperatingSystem())) { + return false; + } + if (!Objects.equals(_size, other.getSize())) { + return false; + } + if (!Objects.equals(_supportedVirtualizationEnvironment, other.getSupportedVirtualizationEnvironment())) { + return false; + } + if (!Objects.equals(_version, other.getVersion())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + SwImageDescImpl otherImpl = (SwImageDescImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("SwImageDesc"); + CodeHelpers.appendValue(helper, "_checksum", _checksum); + CodeHelpers.appendValue(helper, "_containerFormat", _containerFormat); + CodeHelpers.appendValue(helper, "_diskFormat", _diskFormat); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_image", _image); + CodeHelpers.appendValue(helper, "_minDisk", _minDisk); + CodeHelpers.appendValue(helper, "_minRam", _minRam); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_operatingSystem", _operatingSystem); + CodeHelpers.appendValue(helper, "_size", _size); + CodeHelpers.appendValue(helper, "_supportedVirtualizationEnvironment", _supportedVirtualizationEnvironment); + CodeHelpers.appendValue(helper, "_version", _version); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/SwImageDescKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/SwImageDescKey.java new file mode 100644 index 0000000000000000000000000000000000000000..26dddcf8e1944e2c157132ef5f7160003be0619e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/SwImageDescKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class SwImageDescKey + implements Identifier { + private static final long serialVersionUID = 792797036952929257L; + private final String _id; + + + public SwImageDescKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public SwImageDescKey(SwImageDescKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof SwImageDescKey)) { + return false; + } + final SwImageDescKey other = (SwImageDescKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(SwImageDescKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/Vdu.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/Vdu.java new file mode 100644 index 0000000000000000000000000000000000000000..0b54e0a3d2c40a0a10ef30864b0a8e7af8e667d9 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/Vdu.java @@ -0,0 +1,301 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import java.util.List; +import java.util.Map; + +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VduBuilder.VduImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.BootOrder; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.ConfigurableProperties; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.ConfigurablePropertiesKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.IntCpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.IntCpdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.MonitoringParameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.MonitoringParameterKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * The Virtualisation Deployment Unit (VDU) is a construct supporting the + * description of the deployment and operational behaviour of a VNF component, or + * the entire VNF if it was not componentized in components. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list vdu {
+ *   key id;
+ *   min-elements 1;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   list int-cpd {
+ *     key id;
+ *     min-elements 1;
+ *     leaf int-virtual-link-desc {
+ *       type leafref {
+ *         path ../../../int-virtual-link-desc/id;
+ *       }
+ *     }
+ *     leaf bitrate-requirement {
+ *       type uint64;
+ *       units Mbps;
+ *     }
+ *     uses virtual-network-interface-requirements;
+ *     leaf nicio-requirements {
+ *       type leafref {
+ *         path ../../../virtual-compute-desc/id;
+ *       }
+ *     }
+ *     leaf-list order {
+ *       type uint32;
+ *     }
+ *     uses cpd;
+ *     leaf security-group-rule-id {
+ *       type leafref {
+ *         path ../../../security-group-rule/id;
+ *       }
+ *     }
+ *   }
+ *   leaf virtual-compute-desc {
+ *     type leafref {
+ *       path ../../virtual-compute-desc/id;
+ *     }
+ *     must "../../virtual-compute-desc[id=current()]/virtual-memory/size >=../../sw-image-desc[id=current()/../sw-image-desc]/min-ram";
+ *   }
+ *   leaf-list virtual-storage-desc {
+ *     type leafref {
+ *       path ../../virtual-storage-desc/id;
+ *     }
+ *   }
+ *   list boot-order {
+ *     ordered-by user;
+ *     key key;
+ *     leaf key {
+ *       type uint32;
+ *     }
+ *     leaf value {
+ *       type leafref {
+ *         path ../../virtual-storage-desc;
+ *       }
+ *     }
+ *   }
+ *   leaf sw-image-desc {
+ *     type leafref {
+ *       path ../../sw-image-desc/id;
+ *     }
+ *   }
+ *   leaf-list nfvi-constraint {
+ *     type string;
+ *   }
+ *   list monitoring-parameter {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     uses monitoring-parameter;
+ *   }
+ *   list configurable-properties {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ *   leaf boot-data {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/vdu + * + *

To create instances of this class use {@link VduBuilder}. + * @see VduBuilder + * @see VduKey + * + */ +@JsonDeserialize(as = VduImpl.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public interface Vdu + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vdu"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu.class; + } + + /** + * Unique identifier of this VDU in VNFD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Human readable name of the VDU. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Human readable description of the VDU. + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * A internal-connection-point element is a type of connection point and describes + * network connectivity between a VDU instance and an internal Virtual Link or an + * external connection point. + * + * + * + * @return java.util.Map intCpd, or null if not present + */ + @Nullable Map getIntCpd(); + + /** + * @return java.util.Map intCpd, or an empty list if it is not present + */ + default @NonNull Map nonnullIntCpd() { + return CodeHelpers.nonnull(getIntCpd()); + } + + /** + * Describes CPU, Memory and acceleration requirements of the Virtualisation + * Container realizing this VDU. + * + * + * + * @return java.lang.String virtualComputeDesc, or null if not present + */ + @Nullable String getVirtualComputeDesc(); + + /** + * Describes storage requirements for a VirtualStorage instance attached to the + * virtualisation container created from virtualComputeDesc defined for this VDU. + * + * + * + * @return java.util.List virtualStorageDesc, or null if not present + */ + @Nullable List getVirtualStorageDesc(); + + /** + * The key indicates the boot index (lowest index defines highest boot priority). + * The Value references a descriptor from which a valid boot device is created e.g. + * VirtualStorageDesc from which a VirtualStorage instance is created. Editor's + * note: The boot-order node requires further study. + * + * + * + * @return java.util.List bootOrder, or null if not present + */ + @Nullable List getBootOrder(); + + /** + * @return java.util.List bootOrder, or an empty list if it is not present + */ + default @NonNull List nonnullBootOrder() { + return CodeHelpers.nonnull(getBootOrder()); + } + + /** + * Describes the software image which is directly loaded on the virtualisation + * container realising this Vdu. + * + * + * + * @return java.lang.String swImageDesc, or null if not present + */ + @Nullable String getSwImageDesc(); + + /** + * Describes constraints on the NFVI for the VNFC instance(s) created from this + * Vdu. For example, aspects of a secure hosting environment for the VNFC instance + * that involve additional entities or processes. + * + * + * + * @return java.util.List nfviConstraint, or null if not present + */ + @Nullable List getNfviConstraint(); + + /** + * @return java.util.Map monitoringParameter, or null if not present + */ + @Nullable Map getMonitoringParameter(); + + /** + * @return java.util.Map monitoringParameter, or an empty list if it is not present + */ + default @NonNull Map nonnullMonitoringParameter() { + return CodeHelpers.nonnull(getMonitoringParameter()); + } + + /** + * It provides VNFC configurable properties that can be modified using the + * ModifyVnfInfo operation. + * + * + * + * @return java.util.Map configurableProperties, or null if not present + */ + @Nullable Map getConfigurableProperties(); + + /** + * @return java.util.Map configurableProperties, or an empty list if it is not present + */ + default @NonNull Map nonnullConfigurableProperties() { + return CodeHelpers.nonnull(getConfigurableProperties()); + } + + /** + * Contains a string or a URL to a file contained in the VNF package used to + * customize a virtualised compute resource at boot time. The bootData may contain + * variable parts that are replaced by deployment specific values before being sent + * to the VIM. + * + * + * + * @return java.lang.String bootData, or null if not present + */ + @Nullable String getBootData(); + + @Override + VduKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VduBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VduBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..abddb802e6df6ec9d2cdec776a331ee836823972 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VduBuilder.java @@ -0,0 +1,572 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.BootOrder; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.ConfigurableProperties; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.ConfigurablePropertiesKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.IntCpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.IntCpdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.MonitoringParameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.MonitoringParameterKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VduBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VduBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VduBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VduBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VduBuilder + * @see Builder + * + */ +public class VduBuilder implements Builder { + + private String _bootData; + private List _bootOrder; + private Map _configurableProperties; + private String _description; + private String _id; + private Map _intCpd; + private Map _monitoringParameter; + private String _name; + private List _nfviConstraint; + private String _swImageDesc; + private String _virtualComputeDesc; + private List _virtualStorageDesc; + private VduKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VduBuilder() { + } + + public VduBuilder(Vdu base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._bootData = base.getBootData(); + this._bootOrder = base.getBootOrder(); + this._configurableProperties = base.getConfigurableProperties(); + this._description = base.getDescription(); + this._intCpd = base.getIntCpd(); + this._monitoringParameter = base.getMonitoringParameter(); + this._name = base.getName(); + this._nfviConstraint = base.getNfviConstraint(); + this._swImageDesc = base.getSwImageDesc(); + this._virtualComputeDesc = base.getVirtualComputeDesc(); + this._virtualStorageDesc = base.getVirtualStorageDesc(); + } + + + public VduKey key() { + return key; + } + + public String getBootData() { + return _bootData; + } + + public List getBootOrder() { + return _bootOrder; + } + + public Map getConfigurableProperties() { + return _configurableProperties; + } + + public String getDescription() { + return _description; + } + + public String getId() { + return _id; + } + + public Map getIntCpd() { + return _intCpd; + } + + public Map getMonitoringParameter() { + return _monitoringParameter; + } + + public String getName() { + return _name; + } + + public List getNfviConstraint() { + return _nfviConstraint; + } + + public String getSwImageDesc() { + return _swImageDesc; + } + + public String getVirtualComputeDesc() { + return _virtualComputeDesc; + } + + public List getVirtualStorageDesc() { + return _virtualStorageDesc; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VduBuilder withKey(final VduKey key) { + this.key = key; + return this; + } + + public VduBuilder setBootData(final String value) { + this._bootData = value; + return this; + } + public VduBuilder setBootOrder(final List values) { + this._bootOrder = values; + return this; + } + + public VduBuilder setConfigurableProperties(final Map values) { + this._configurableProperties = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setConfigurableProperties(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VduBuilder setConfigurableProperties(final List values) { + return setConfigurableProperties(CodeHelpers.compatMap(values)); + } + + public VduBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public VduBuilder setId(final String value) { + this._id = value; + return this; + } + public VduBuilder setIntCpd(final Map values) { + this._intCpd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setIntCpd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VduBuilder setIntCpd(final List values) { + return setIntCpd(CodeHelpers.compatMap(values)); + } + public VduBuilder setMonitoringParameter(final Map values) { + this._monitoringParameter = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setMonitoringParameter(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VduBuilder setMonitoringParameter(final List values) { + return setMonitoringParameter(CodeHelpers.compatMap(values)); + } + + public VduBuilder setName(final String value) { + this._name = value; + return this; + } + public VduBuilder setNfviConstraint(final List values) { + this._nfviConstraint = values; + return this; + } + + + public VduBuilder setSwImageDesc(final String value) { + this._swImageDesc = value; + return this; + } + + public VduBuilder setVirtualComputeDesc(final String value) { + this._virtualComputeDesc = value; + return this; + } + public VduBuilder setVirtualStorageDesc(final List values) { + this._virtualStorageDesc = values; + return this; + } + + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VduBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VduBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VduBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VduBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Vdu build() { + return new VduImpl(this); + } + + public static final class VduImpl + extends AbstractAugmentable + implements Vdu { + + private final String _bootData; + private final List _bootOrder; + private final Map _configurableProperties; + private final String _description; + @JsonProperty("id") + private final String _id; + private final Map _intCpd; + private final Map _monitoringParameter; + @JsonProperty("name") + private final String _name; + private final List _nfviConstraint; + @JsonProperty("sw-image-desc") + private final String _swImageDesc; + private final String _virtualComputeDesc; + private final List _virtualStorageDesc; + private VduKey key; + + VduImpl(VduBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VduKey(base.getId()); + } + this._id = key.getId(); + this._bootData = base.getBootData(); + this._bootOrder = CodeHelpers.emptyToNull(base.getBootOrder()); + this._configurableProperties = CodeHelpers.emptyToNull(base.getConfigurableProperties()); + this._description = base.getDescription(); + this._intCpd = CodeHelpers.emptyToNull(base.getIntCpd()); + this._monitoringParameter = CodeHelpers.emptyToNull(base.getMonitoringParameter()); + this._name = base.getName(); + this._nfviConstraint = base.getNfviConstraint(); + this._swImageDesc = base.getSwImageDesc(); + this._virtualComputeDesc = base.getVirtualComputeDesc(); + this._virtualStorageDesc = base.getVirtualStorageDesc(); + } + + public VduImpl() { + this( new VduBuilder()); + } + + + @Override + public VduKey key() { + if ( ( key != null) && ( key.getId() == null) && ( _id != null) ) { + key = new VduKey(_id); + } + return key; + } + + @Override + public String getBootData() { + return _bootData; + } + + @Override + public List getBootOrder() { + return _bootOrder; + } + + @Override + public Map getConfigurableProperties() { + return _configurableProperties; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getIntCpd() { + return _intCpd; + } + + @Override + public Map getMonitoringParameter() { + return _monitoringParameter; + } + + @Override + public String getName() { + return _name; + } + + @Override + public List getNfviConstraint() { + return _nfviConstraint; + } + + @Override + public String getSwImageDesc() { + return _swImageDesc; + } + + @Override + public String getVirtualComputeDesc() { + return _virtualComputeDesc; + } + + @Override + public List getVirtualStorageDesc() { + return _virtualStorageDesc; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_bootData); + result = prime * result + Objects.hashCode(_bootOrder); + result = prime * result + Objects.hashCode(_configurableProperties); + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_intCpd); + result = prime * result + Objects.hashCode(_monitoringParameter); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_nfviConstraint); + result = prime * result + Objects.hashCode(_swImageDesc); + result = prime * result + Objects.hashCode(_virtualComputeDesc); + result = prime * result + Objects.hashCode(_virtualStorageDesc); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vdu.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vdu other = (Vdu)obj; + if (!Objects.equals(_bootData, other.getBootData())) { + return false; + } + if (!Objects.equals(_bootOrder, other.getBootOrder())) { + return false; + } + if (!Objects.equals(_configurableProperties, other.getConfigurableProperties())) { + return false; + } + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_intCpd, other.getIntCpd())) { + return false; + } + if (!Objects.equals(_monitoringParameter, other.getMonitoringParameter())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_nfviConstraint, other.getNfviConstraint())) { + return false; + } + if (!Objects.equals(_swImageDesc, other.getSwImageDesc())) { + return false; + } + if (!Objects.equals(_virtualComputeDesc, other.getVirtualComputeDesc())) { + return false; + } + if (!Objects.equals(_virtualStorageDesc, other.getVirtualStorageDesc())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VduImpl otherImpl = (VduImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vdu"); + CodeHelpers.appendValue(helper, "_bootData", _bootData); + CodeHelpers.appendValue(helper, "_bootOrder", _bootOrder); + CodeHelpers.appendValue(helper, "_configurableProperties", _configurableProperties); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_intCpd", _intCpd); + CodeHelpers.appendValue(helper, "_monitoringParameter", _monitoringParameter); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_nfviConstraint", _nfviConstraint); + CodeHelpers.appendValue(helper, "_swImageDesc", _swImageDesc); + CodeHelpers.appendValue(helper, "_virtualComputeDesc", _virtualComputeDesc); + CodeHelpers.appendValue(helper, "_virtualStorageDesc", _virtualStorageDesc); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VduKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VduKey.java new file mode 100644 index 0000000000000000000000000000000000000000..38cc37ce64fa7ee11dd0c2479c49caf507efda9a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VduKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VduKey + implements Identifier { + private static final long serialVersionUID = 2655467629240519313L; + private final String _id; + + + public VduKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VduKey(VduKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VduKey)) { + return false; + } + final VduKey other = (VduKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VduKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualComputeDesc.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualComputeDesc.java new file mode 100644 index 0000000000000000000000000000000000000000..ffdd5a8bac52d767b4f01bbdcaebd09f11e98215 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualComputeDesc.java @@ -0,0 +1,246 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDescBuilder.VirtualComputeDescImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.LogicalNode; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.LogicalNodeKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.RequestAdditionalCapability; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.RequestAdditionalCapabilityKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualCpu; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualMemory; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Defines descriptors of virtual compute resources to be used by the VNF. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list virtual-compute-desc {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   list logical-node {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     list requirement-detail {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   list request-additional-capability {
+ *     key name;
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf support-mandatory {
+ *       type boolean;
+ *     }
+ *     leaf min-version {
+ *       type string;
+ *     }
+ *     leaf preferred-version {
+ *       type string;
+ *     }
+ *     list target-performance-parameters {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   leaf compute-requirements {
+ *     type string;
+ *   }
+ *   container virtual-memory {
+ *     leaf size {
+ *       type decimal64 {
+ *         fraction-digits 1;
+ *         range 0..max;
+ *       }
+ *       units GB;
+ *       default 1;
+ *     }
+ *     leaf over-subscription-policy {
+ *       type string;
+ *     }
+ *     list vdu-mem-requirements {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *     leaf numa-enabled {
+ *       type boolean;
+ *     }
+ *   }
+ *   container virtual-cpu {
+ *     leaf cpu-architecture {
+ *       type string;
+ *     }
+ *     leaf num-virtual-cpu {
+ *       type uint16 {
+ *         range 1..max;
+ *       }
+ *       default 1;
+ *     }
+ *     leaf clock {
+ *       type uint32;
+ *       units MHz;
+ *     }
+ *     leaf oversubscription-policy {
+ *       type string;
+ *     }
+ *     list vdu-cpu-requirements {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *     container pinning {
+ *       presence "Set to specify CPU pinning.";
+ *       leaf policy {
+ *         default dynamic;
+ *         type enumeration {
+ *           enum static;
+ *           enum dynamic;
+ *         }
+ *       }
+ *       list rule {
+ *         when "../policy = 'static'";
+ *         key key;
+ *         leaf key {
+ *           type string;
+ *         }
+ *         leaf value {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-compute-desc + * + *

To create instances of this class use {@link VirtualComputeDescBuilder}. + * @see VirtualComputeDescBuilder + * @see VirtualComputeDescKey + * + */ +@JsonDeserialize(as = VirtualComputeDescImpl.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public interface VirtualComputeDesc + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-compute-desc"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDesc.class; + } + + /** + * Unique identifier of this VirtualComputeDesc in the VNFD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * The logical node requirements. + * + * + * + * @return java.util.Map logicalNode, or null if not present + */ + @Nullable Map getLogicalNode(); + + /** + * @return java.util.Map logicalNode, or an empty list if it is not present + */ + default @NonNull Map nonnullLogicalNode() { + return CodeHelpers.nonnull(getLogicalNode()); + } + + /** + * @return java.util.Map requestAdditionalCapability, or null if not present + */ + @Nullable Map getRequestAdditionalCapability(); + + /** + * @return java.util.Map requestAdditionalCapability, or an empty list if it is not present + */ + default @NonNull Map nonnullRequestAdditionalCapability() { + return CodeHelpers.nonnull(getRequestAdditionalCapability()); + } + + /** + * Specifies compute requirements. + * + * + * + * @return java.lang.String computeRequirements, or null if not present + */ + @Nullable String getComputeRequirements(); + + /** + * The virtual memory of the virtualised compute. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualMemory virtualMemory, or null if not present + */ + @Nullable VirtualMemory getVirtualMemory(); + + /** + * The virtual CPU(s)of the virtualised compute. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualCpu virtualCpu, or null if not present + */ + @Nullable VirtualCpu getVirtualCpu(); + + @Override + VirtualComputeDescKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualComputeDescBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualComputeDescBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..f2b07dd07a9a121c2a86fa236f8e63686c8618a0 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualComputeDescBuilder.java @@ -0,0 +1,416 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.LogicalNode; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.LogicalNodeKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.RequestAdditionalCapability; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.RequestAdditionalCapabilityKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualCpu; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualMemory; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualComputeDescBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualComputeDescBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualComputeDescBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualComputeDescBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualComputeDescBuilder + * @see Builder + * + */ +public class VirtualComputeDescBuilder implements Builder { + + private String _computeRequirements; + private String _id; + private Map _logicalNode; + private Map _requestAdditionalCapability; + private VirtualCpu _virtualCpu; + private VirtualMemory _virtualMemory; + private VirtualComputeDescKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualComputeDescBuilder() { + } + + public VirtualComputeDescBuilder(VirtualComputeDesc base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._computeRequirements = base.getComputeRequirements(); + this._logicalNode = base.getLogicalNode(); + this._requestAdditionalCapability = base.getRequestAdditionalCapability(); + this._virtualCpu = base.getVirtualCpu(); + this._virtualMemory = base.getVirtualMemory(); + } + + + public VirtualComputeDescKey key() { + return key; + } + + public String getComputeRequirements() { + return _computeRequirements; + } + + public String getId() { + return _id; + } + + public Map getLogicalNode() { + return _logicalNode; + } + + public Map getRequestAdditionalCapability() { + return _requestAdditionalCapability; + } + + public VirtualCpu getVirtualCpu() { + return _virtualCpu; + } + + public VirtualMemory getVirtualMemory() { + return _virtualMemory; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VirtualComputeDescBuilder withKey(final VirtualComputeDescKey key) { + this.key = key; + return this; + } + + public VirtualComputeDescBuilder setComputeRequirements(final String value) { + this._computeRequirements = value; + return this; + } + + public VirtualComputeDescBuilder setId(final String value) { + this._id = value; + return this; + } + public VirtualComputeDescBuilder setLogicalNode(final Map values) { + this._logicalNode = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setLogicalNode(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualComputeDescBuilder setLogicalNode(final List values) { + return setLogicalNode(CodeHelpers.compatMap(values)); + } + public VirtualComputeDescBuilder setRequestAdditionalCapability(final Map values) { + this._requestAdditionalCapability = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setRequestAdditionalCapability(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualComputeDescBuilder setRequestAdditionalCapability(final List values) { + return setRequestAdditionalCapability(CodeHelpers.compatMap(values)); + } + + public VirtualComputeDescBuilder setVirtualCpu(final VirtualCpu value) { + this._virtualCpu = value; + return this; + } + + public VirtualComputeDescBuilder setVirtualMemory(final VirtualMemory value) { + this._virtualMemory = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualComputeDescBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualComputeDescBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualComputeDescBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualComputeDescBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualComputeDesc build() { + return new VirtualComputeDescImpl(this); + } + + public static final class VirtualComputeDescImpl + extends AbstractAugmentable + implements VirtualComputeDesc { + + private final String _computeRequirements; + @JsonProperty("id") + private final String _id; + private final Map _logicalNode; + private final Map _requestAdditionalCapability; + @JsonProperty("virtual-cpu") + private final VirtualCpu _virtualCpu; + @JsonProperty("virtual-memory") + private final VirtualMemory _virtualMemory; + private VirtualComputeDescKey key; + + VirtualComputeDescImpl(VirtualComputeDescBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VirtualComputeDescKey(base.getId()); + } + this._id = key.getId(); + this._computeRequirements = base.getComputeRequirements(); + this._logicalNode = CodeHelpers.emptyToNull(base.getLogicalNode()); + this._requestAdditionalCapability = CodeHelpers.emptyToNull(base.getRequestAdditionalCapability()); + this._virtualCpu = base.getVirtualCpu(); + this._virtualMemory = base.getVirtualMemory(); + } + + + public VirtualComputeDescImpl() { + this( new VirtualComputeDescBuilder()); + } + + @Override + public VirtualComputeDescKey key() { + if ( ( key != null) && ( key.getId() == null) && ( _id != null) ) { + key = new VirtualComputeDescKey(_id); + } + return key; + } + + @Override + public String getComputeRequirements() { + return _computeRequirements; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getLogicalNode() { + return _logicalNode; + } + + @Override + public Map getRequestAdditionalCapability() { + return _requestAdditionalCapability; + } + + @Override + public VirtualCpu getVirtualCpu() { + return _virtualCpu; + } + + @Override + public VirtualMemory getVirtualMemory() { + return _virtualMemory; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_computeRequirements); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_logicalNode); + result = prime * result + Objects.hashCode(_requestAdditionalCapability); + result = prime * result + Objects.hashCode(_virtualCpu); + result = prime * result + Objects.hashCode(_virtualMemory); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualComputeDesc.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualComputeDesc other = (VirtualComputeDesc)obj; + if (!Objects.equals(_computeRequirements, other.getComputeRequirements())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_logicalNode, other.getLogicalNode())) { + return false; + } + if (!Objects.equals(_requestAdditionalCapability, other.getRequestAdditionalCapability())) { + return false; + } + if (!Objects.equals(_virtualCpu, other.getVirtualCpu())) { + return false; + } + if (!Objects.equals(_virtualMemory, other.getVirtualMemory())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualComputeDescImpl otherImpl = (VirtualComputeDescImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualComputeDesc"); + CodeHelpers.appendValue(helper, "_computeRequirements", _computeRequirements); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_logicalNode", _logicalNode); + CodeHelpers.appendValue(helper, "_requestAdditionalCapability", _requestAdditionalCapability); + CodeHelpers.appendValue(helper, "_virtualCpu", _virtualCpu); + CodeHelpers.appendValue(helper, "_virtualMemory", _virtualMemory); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualComputeDescKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualComputeDescKey.java new file mode 100644 index 0000000000000000000000000000000000000000..4b13cfc3480b7e33f00b6b0da6704c6d4626e972 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualComputeDescKey.java @@ -0,0 +1,73 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.KeyDeserializer; +import com.google.common.base.MoreObjects; + +import java.io.IOException; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VirtualComputeDescKey extends KeyDeserializer + implements Identifier { + private static final long serialVersionUID = -1836114838188485829L; + private final String _id; + + + public VirtualComputeDescKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VirtualComputeDescKey(VirtualComputeDescKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VirtualComputeDescKey)) { + return false; + } + final VirtualComputeDescKey other = (VirtualComputeDescKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VirtualComputeDescKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } + + @Override + public Object deserializeKey(String key, DeserializationContext ctxt) throws IOException { + // TODO Auto-generated method stub + return this.toString(); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualStorageDesc.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualStorageDesc.java new file mode 100644 index 0000000000000000000000000000000000000000..79304ba8b1e7b1d83a25c0ff77c39c31337f3f95 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualStorageDesc.java @@ -0,0 +1,159 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.StorageType; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDescBuilder.VirtualStorageDescImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.storage.desc.VduStorageRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.storage.desc.VduStorageRequirementsKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint64; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Storage requirements for a Virtual Storage instance attached to the VNFC + * from this VDU + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list virtual-storage-desc {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf type-of-storage {
+ *     default root-storage;
+ *     type identityref {
+ *       base storage-type;
+ *     }
+ *   }
+ *   leaf size-of-storage {
+ *     type uint64;
+ *     units GB;
+ *     default 0;
+ *   }
+ *   list vdu-storage-requirements {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ *   leaf rdma-enabled {
+ *     type boolean;
+ *   }
+ *   leaf sw-image-desc {
+ *     type leafref {
+ *       path ../../sw-image-desc/id;
+ *     }
+ *     must "../size-of-storage >=../../sw-image-desc[id=current()]/min-disk";
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-storage-desc + * + *

To create instances of this class use {@link VirtualStorageDescBuilder}. + * @see VirtualStorageDescBuilder + * @see VirtualStorageDescKey + * + */ +@JsonDeserialize(as = VirtualStorageDescImpl.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public interface VirtualStorageDesc + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-storage-desc"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDesc.class; + } + + /** + * Unique identifier of this VirtualStorageDesc in the VNFD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Type of virtualised storage resource (e.g. volume, object). + * + * + * + * @return java.lang.Class typeOfStorage, or null if not present + */ + @Nullable Class getTypeOfStorage(); + + /** + * Size of virtualised storage resource (e.g. size of volume, in GB) + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 sizeOfStorage, or null if not present + */ + @Nullable Uint64 getSizeOfStorage(); + + /** + * Array of key-value pairs that articulate the storage deployment requirements. + * + * + * + * @return java.util.Map vduStorageRequirements, or null if not present + */ + @Nullable Map getVduStorageRequirements(); + + /** + * @return java.util.Map vduStorageRequirements, or an empty list if it is not present + */ + default @NonNull Map nonnullVduStorageRequirements() { + return CodeHelpers.nonnull(getVduStorageRequirements()); + } + + /** + * Indicate if the storage support RDMA. + * + * + * + * @return java.lang.Boolean rdmaEnabled, or null if not present + */ + @Nullable Boolean isRdmaEnabled(); + + /** + * Software image to be loaded on the VirtualStorage resource created based on this + * VirtualStorageDesc. + * + * + * + * @return java.lang.String swImageDesc, or null if not present + */ + @Nullable String getSwImageDesc(); + + @Override + VirtualStorageDescKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualStorageDescBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualStorageDescBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..4690e4d0118495d63da17fb2688816179a3981a3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualStorageDescBuilder.java @@ -0,0 +1,409 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.StorageType; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.storage.desc.VduStorageRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.storage.desc.VduStorageRequirementsKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link VirtualStorageDescBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualStorageDescBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualStorageDescBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualStorageDescBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualStorageDescBuilder + * @see Builder + * + */ +public class VirtualStorageDescBuilder implements Builder { + + private String _id; + private Uint64 _sizeOfStorage; + private String _swImageDesc; + private Class _typeOfStorage; + private Map _vduStorageRequirements; + private Boolean _rdmaEnabled; + private VirtualStorageDescKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualStorageDescBuilder() { + } + + public VirtualStorageDescBuilder(VirtualStorageDesc base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._sizeOfStorage = base.getSizeOfStorage(); + this._swImageDesc = base.getSwImageDesc(); + this._typeOfStorage = base.getTypeOfStorage(); + this._vduStorageRequirements = base.getVduStorageRequirements(); + this._rdmaEnabled = base.isRdmaEnabled(); + } + + + public VirtualStorageDescKey key() { + return key; + } + + public String getId() { + return _id; + } + + public Uint64 getSizeOfStorage() { + return _sizeOfStorage; + } + + public String getSwImageDesc() { + return _swImageDesc; + } + + public Class getTypeOfStorage() { + return _typeOfStorage; + } + + public Map getVduStorageRequirements() { + return _vduStorageRequirements; + } + + public Boolean isRdmaEnabled() { + return _rdmaEnabled; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VirtualStorageDescBuilder withKey(final VirtualStorageDescKey key) { + this.key = key; + return this; + } + + public VirtualStorageDescBuilder setId(final String value) { + this._id = value; + return this; + } + + public VirtualStorageDescBuilder setSizeOfStorage(final Uint64 value) { + this._sizeOfStorage = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setSizeOfStorage(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualStorageDescBuilder setSizeOfStorage(final BigInteger value) { + return setSizeOfStorage(CodeHelpers.compatUint(value)); + } + + public VirtualStorageDescBuilder setSwImageDesc(final String value) { + this._swImageDesc = value; + return this; + } + + public VirtualStorageDescBuilder setTypeOfStorage(final Class value) { + this._typeOfStorage = value; + return this; + } + public VirtualStorageDescBuilder setVduStorageRequirements(final Map values) { + this._vduStorageRequirements = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVduStorageRequirements(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualStorageDescBuilder setVduStorageRequirements(final List values) { + return setVduStorageRequirements(CodeHelpers.compatMap(values)); + } + + public VirtualStorageDescBuilder setRdmaEnabled(final Boolean value) { + this._rdmaEnabled = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualStorageDescBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualStorageDescBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualStorageDescBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualStorageDescBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualStorageDesc build() { + return new VirtualStorageDescImpl(this); + } + + public static final class VirtualStorageDescImpl + extends AbstractAugmentable + implements VirtualStorageDesc { + + @JsonProperty("id") + private final String _id; + @JsonProperty("size-of-storage") + private final Uint64 _sizeOfStorage; + private final String _swImageDesc; + private final Class _typeOfStorage; + private final Map _vduStorageRequirements; + private final Boolean _rdmaEnabled; + private VirtualStorageDescKey key; + + VirtualStorageDescImpl(VirtualStorageDescBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VirtualStorageDescKey(base.getId()); + } + this._id = key.getId(); + this._sizeOfStorage = base.getSizeOfStorage(); + this._swImageDesc = base.getSwImageDesc(); + this._typeOfStorage = base.getTypeOfStorage(); + this._vduStorageRequirements = CodeHelpers.emptyToNull(base.getVduStorageRequirements()); + this._rdmaEnabled = base.isRdmaEnabled(); + } + + public VirtualStorageDescImpl() { + this( new VirtualStorageDescBuilder()); + } + + @Override + public VirtualStorageDescKey key() { + if ( ( key != null) && ( key.getId() == null) && ( _id != null) ) { + key = new VirtualStorageDescKey(_id); + } + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Uint64 getSizeOfStorage() { + return _sizeOfStorage; + } + + @Override + public String getSwImageDesc() { + return _swImageDesc; + } + + @Override + public Class getTypeOfStorage() { + return _typeOfStorage; + } + + @Override + public Map getVduStorageRequirements() { + return _vduStorageRequirements; + } + + @Override + public Boolean isRdmaEnabled() { + return _rdmaEnabled; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_sizeOfStorage); + result = prime * result + Objects.hashCode(_swImageDesc); + result = prime * result + Objects.hashCode(_typeOfStorage); + result = prime * result + Objects.hashCode(_vduStorageRequirements); + result = prime * result + Objects.hashCode(_rdmaEnabled); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualStorageDesc.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualStorageDesc other = (VirtualStorageDesc)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_sizeOfStorage, other.getSizeOfStorage())) { + return false; + } + if (!Objects.equals(_swImageDesc, other.getSwImageDesc())) { + return false; + } + if (!Objects.equals(_typeOfStorage, other.getTypeOfStorage())) { + return false; + } + if (!Objects.equals(_vduStorageRequirements, other.getVduStorageRequirements())) { + return false; + } + if (!Objects.equals(_rdmaEnabled, other.isRdmaEnabled())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualStorageDescImpl otherImpl = (VirtualStorageDescImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualStorageDesc"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_sizeOfStorage", _sizeOfStorage); + CodeHelpers.appendValue(helper, "_swImageDesc", _swImageDesc); + CodeHelpers.appendValue(helper, "_typeOfStorage", _typeOfStorage); + CodeHelpers.appendValue(helper, "_vduStorageRequirements", _vduStorageRequirements); + CodeHelpers.appendValue(helper, "_rdmaEnabled", _rdmaEnabled); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualStorageDescKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualStorageDescKey.java new file mode 100644 index 0000000000000000000000000000000000000000..a11f8279b5bd6f558d6ba2493ec15f7c9d2946ad --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/VirtualStorageDescKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VirtualStorageDescKey + implements Identifier { + private static final long serialVersionUID = -3095943427735575648L; + private final String _id; + + + public VirtualStorageDescKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VirtualStorageDescKey(VirtualStorageDescKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VirtualStorageDescKey)) { + return false; + } + final VirtualStorageDescKey other = (VirtualStorageDescKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VirtualStorageDescKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/Flavour.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/Flavour.java new file mode 100644 index 0000000000000000000000000000000000000000..9ade2b9e1926f663dad55e06685f0cb166d78702 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/Flavour.java @@ -0,0 +1,90 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IntVirtualLinkDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.flavour.Qos; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes a specific flavour of the VL with specific bitrate requirements. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list flavour {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   container qos {
+ *     presence "VL QoS parameters";
+ *     leaf latency {
+ *       type uint32;
+ *       units ms;
+ *     }
+ *     leaf packet-delay-variation {
+ *       type uint32;
+ *       units ms;
+ *     }
+ *     leaf packet-loss-ratio {
+ *       type decimal64 {
+ *         fraction-digits 2;
+ *         range 0..1.00;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/int-virtual-link-desc/flavour + * + *

To create instances of this class use {@link FlavourBuilder}. + * @see FlavourBuilder + * @see FlavourKey + * + */ +public interface Flavour + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("flavour"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.Flavour.class; + } + + /** + * Identifies a flavour within a VnfVirtualLinkDesc. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * QoS of the VL. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.flavour.Qos qos, or null if not present + */ + @Nullable Qos getQos(); + + @Override + FlavourKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/FlavourBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/FlavourBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..64c45a7d168f5021f0b56ba7ec5c1ccd54551642 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/FlavourBuilder.java @@ -0,0 +1,272 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.flavour.Qos; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link FlavourBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     FlavourBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new FlavourBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of FlavourBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see FlavourBuilder + * @see Builder + * + */ +public class FlavourBuilder implements Builder { + + private String _id; + private Qos _qos; + private FlavourKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public FlavourBuilder() { + } + + public FlavourBuilder(Flavour base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._qos = base.getQos(); + } + + + public FlavourKey key() { + return key; + } + + public String getId() { + return _id; + } + + public Qos getQos() { + return _qos; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public FlavourBuilder withKey(final FlavourKey key) { + this.key = key; + return this; + } + + public FlavourBuilder setId(final String value) { + this._id = value; + return this; + } + + public FlavourBuilder setQos(final Qos value) { + this._qos = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public FlavourBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public FlavourBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public FlavourBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private FlavourBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Flavour build() { + return new FlavourImpl(this); + } + + private static final class FlavourImpl + extends AbstractAugmentable + implements Flavour { + + private final String _id; + private final Qos _qos; + private final FlavourKey key; + + FlavourImpl(FlavourBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new FlavourKey(base.getId()); + } + this._id = key.getId(); + this._qos = base.getQos(); + } + + @Override + public FlavourKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Qos getQos() { + return _qos; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_qos); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Flavour.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Flavour other = (Flavour)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_qos, other.getQos())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + FlavourImpl otherImpl = (FlavourImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Flavour"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_qos", _qos); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/FlavourKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/FlavourKey.java new file mode 100644 index 0000000000000000000000000000000000000000..4f11a8c8d2fcc7325f3a4f4b156f9f38803397c5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/FlavourKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class FlavourKey + implements Identifier { + private static final long serialVersionUID = 3845688501799640719L; + private final String _id; + + + public FlavourKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public FlavourKey(FlavourKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof FlavourKey)) { + return false; + } + final FlavourKey other = (FlavourKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(FlavourKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/MonitoringParameters.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/MonitoringParameters.java new file mode 100644 index 0000000000000000000000000000000000000000..d898376925b1ec18039b365f3e8193e03dceb65d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/MonitoringParameters.java @@ -0,0 +1,65 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IntVirtualLinkDesc; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list monitoring-parameters {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   uses monitoring-parameter;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/int-virtual-link-desc/monitoring-parameters + * + *

To create instances of this class use {@link MonitoringParametersBuilder}. + * @see MonitoringParametersBuilder + * @see MonitoringParametersKey + * + */ +public interface MonitoringParameters + extends + ChildOf, + Augmentable, + MonitoringParameter, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("monitoring-parameters"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.MonitoringParameters.class; + } + + /** + * Unique identifier of the monitoring parameter. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + @Override + MonitoringParametersKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/MonitoringParametersBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/MonitoringParametersBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..187f21837d1471b9f938ea3a40429f7af0d96adb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/MonitoringParametersBuilder.java @@ -0,0 +1,355 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link MonitoringParametersBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     MonitoringParametersBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new MonitoringParametersBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of MonitoringParametersBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see MonitoringParametersBuilder + * @see Builder + * + */ +public class MonitoringParametersBuilder implements Builder { + + private Uint64 _collectionPeriod; + private String _id; + private String _name; + private String _performanceMetric; + private MonitoringParametersKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public MonitoringParametersBuilder() { + } + public MonitoringParametersBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter arg) { + this._name = arg.getName(); + this._performanceMetric = arg.getPerformanceMetric(); + this._collectionPeriod = arg.getCollectionPeriod(); + } + + public MonitoringParametersBuilder(MonitoringParameters base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._collectionPeriod = base.getCollectionPeriod(); + this._name = base.getName(); + this._performanceMetric = base.getPerformanceMetric(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter) { + this._name = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter)arg).getName(); + this._performanceMetric = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter)arg).getPerformanceMetric(); + this._collectionPeriod = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter)arg).getCollectionPeriod(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter]"); + } + + public MonitoringParametersKey key() { + return key; + } + + public Uint64 getCollectionPeriod() { + return _collectionPeriod; + } + + public String getId() { + return _id; + } + + public String getName() { + return _name; + } + + public String getPerformanceMetric() { + return _performanceMetric; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public MonitoringParametersBuilder withKey(final MonitoringParametersKey key) { + this.key = key; + return this; + } + + public MonitoringParametersBuilder setCollectionPeriod(final Uint64 value) { + this._collectionPeriod = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setCollectionPeriod(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public MonitoringParametersBuilder setCollectionPeriod(final BigInteger value) { + return setCollectionPeriod(CodeHelpers.compatUint(value)); + } + + public MonitoringParametersBuilder setId(final String value) { + this._id = value; + return this; + } + + public MonitoringParametersBuilder setName(final String value) { + this._name = value; + return this; + } + + public MonitoringParametersBuilder setPerformanceMetric(final String value) { + this._performanceMetric = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public MonitoringParametersBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public MonitoringParametersBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public MonitoringParametersBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private MonitoringParametersBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public MonitoringParameters build() { + return new MonitoringParametersImpl(this); + } + + private static final class MonitoringParametersImpl + extends AbstractAugmentable + implements MonitoringParameters { + + private final Uint64 _collectionPeriod; + private final String _id; + private final String _name; + private final String _performanceMetric; + private final MonitoringParametersKey key; + + MonitoringParametersImpl(MonitoringParametersBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new MonitoringParametersKey(base.getId()); + } + this._id = key.getId(); + this._collectionPeriod = base.getCollectionPeriod(); + this._name = base.getName(); + this._performanceMetric = base.getPerformanceMetric(); + } + + @Override + public MonitoringParametersKey key() { + return key; + } + + @Override + public Uint64 getCollectionPeriod() { + return _collectionPeriod; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getName() { + return _name; + } + + @Override + public String getPerformanceMetric() { + return _performanceMetric; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_collectionPeriod); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_performanceMetric); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!MonitoringParameters.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + MonitoringParameters other = (MonitoringParameters)obj; + if (!Objects.equals(_collectionPeriod, other.getCollectionPeriod())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_performanceMetric, other.getPerformanceMetric())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + MonitoringParametersImpl otherImpl = (MonitoringParametersImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("MonitoringParameters"); + CodeHelpers.appendValue(helper, "_collectionPeriod", _collectionPeriod); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_performanceMetric", _performanceMetric); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/MonitoringParametersKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/MonitoringParametersKey.java new file mode 100644 index 0000000000000000000000000000000000000000..d3f71e52ab1d762643577ca02bbbe6a82619b79b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/MonitoringParametersKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class MonitoringParametersKey + implements Identifier { + private static final long serialVersionUID = 4943139000410270101L; + private final String _id; + + + public MonitoringParametersKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public MonitoringParametersKey(MonitoringParametersKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof MonitoringParametersKey)) { + return false; + } + final MonitoringParametersKey other = (MonitoringParametersKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(MonitoringParametersKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/flavour/Qos.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/flavour/Qos.java new file mode 100644 index 0000000000000000000000000000000000000000..90264fd25bc6b54f13a8d50efbb121c5100cc3af --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/flavour/Qos.java @@ -0,0 +1,87 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.flavour; +import java.lang.Class; +import java.lang.Override; +import java.math.BigDecimal; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.Flavour; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * QoS of the VL. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container qos {
+ *   presence "VL QoS parameters";
+ *   leaf latency {
+ *     type uint32;
+ *     units ms;
+ *   }
+ *   leaf packet-delay-variation {
+ *     type uint32;
+ *     units ms;
+ *   }
+ *   leaf packet-loss-ratio {
+ *     type decimal64 {
+ *       fraction-digits 2;
+ *       range 0..1.00;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/int-virtual-link-desc/flavour/qos + * + *

To create instances of this class use {@link QosBuilder}. + * @see QosBuilder + * + */ +public interface Qos + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("qos"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.flavour.Qos.class; + } + + /** + * Specifies the maximum latency in ms. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 latency, or null if not present + */ + @Nullable Uint32 getLatency(); + + /** + * Specifies the maximum jitter in ms. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 packetDelayVariation, or null if not present + */ + @Nullable Uint32 getPacketDelayVariation(); + + /** + * Specifies the maximum packet loss ratio. + * + * + * + * @return java.math.BigDecimal packetLossRatio, or null if not present + */ + @Nullable BigDecimal getPacketLossRatio(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/flavour/QosBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/flavour/QosBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..e3ee1406e05eb91b54ec092f00fc9c84d6354dcc --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/_int/virtual/link/desc/flavour/QosBuilder.java @@ -0,0 +1,322 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd._int.virtual.link.desc.flavour; +import com.google.common.base.MoreObjects; +import com.google.common.collect.Range; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.lang.reflect.Array; +import java.math.BigDecimal; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link QosBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     QosBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new QosBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of QosBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see QosBuilder + * @see Builder + * + */ +public class QosBuilder implements Builder { + + private Uint32 _latency; + private Uint32 _packetDelayVariation; + private BigDecimal _packetLossRatio; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public QosBuilder() { + } + + public QosBuilder(Qos base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._latency = base.getLatency(); + this._packetDelayVariation = base.getPacketDelayVariation(); + this._packetLossRatio = base.getPacketLossRatio(); + } + + + public Uint32 getLatency() { + return _latency; + } + + public Uint32 getPacketDelayVariation() { + return _packetDelayVariation; + } + + public BigDecimal getPacketLossRatio() { + return _packetLossRatio; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public QosBuilder setLatency(final Uint32 value) { + this._latency = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLatency(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public QosBuilder setLatency(final Long value) { + return setLatency(CodeHelpers.compatUint(value)); + } + + public QosBuilder setPacketDelayVariation(final Uint32 value) { + this._packetDelayVariation = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setPacketDelayVariation(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public QosBuilder setPacketDelayVariation(final Long value) { + return setPacketDelayVariation(CodeHelpers.compatUint(value)); + } + + private static final Range[] CHECKPACKETLOSSRATIORANGE_RANGES; + static { + @SuppressWarnings("unchecked") + final Range[] a = (Range[]) Array.newInstance(Range.class, 1); + a[0] = Range.closed(java.math.BigDecimal.ZERO, new java.math.BigDecimal("1.00")); + CHECKPACKETLOSSRATIORANGE_RANGES = a; + } + private static void checkPacketLossRatioRange(final java.math.BigDecimal value) { + for (Range r : CHECKPACKETLOSSRATIORANGE_RANGES) { + if (r.contains(value)) { + return; + } + } + CodeHelpers.throwInvalidRange(CHECKPACKETLOSSRATIORANGE_RANGES, value); + } + + public QosBuilder setPacketLossRatio(final BigDecimal value) { + if (value != null) { + checkPacketLossRatioRange(value); + + } + this._packetLossRatio = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public QosBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public QosBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public QosBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private QosBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Qos build() { + return new QosImpl(this); + } + + private static final class QosImpl + extends AbstractAugmentable + implements Qos { + + private final Uint32 _latency; + private final Uint32 _packetDelayVariation; + private final BigDecimal _packetLossRatio; + + QosImpl(QosBuilder base) { + super(base.augmentation); + this._latency = base.getLatency(); + this._packetDelayVariation = base.getPacketDelayVariation(); + this._packetLossRatio = base.getPacketLossRatio(); + } + + @Override + public Uint32 getLatency() { + return _latency; + } + + @Override + public Uint32 getPacketDelayVariation() { + return _packetDelayVariation; + } + + @Override + public BigDecimal getPacketLossRatio() { + return _packetLossRatio; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_latency); + result = prime * result + Objects.hashCode(_packetDelayVariation); + result = prime * result + Objects.hashCode(_packetLossRatio); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Qos.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Qos other = (Qos)obj; + if (!Objects.equals(_latency, other.getLatency())) { + return false; + } + if (!Objects.equals(_packetDelayVariation, other.getPacketDelayVariation())) { + return false; + } + if (!Objects.equals(_packetLossRatio, other.getPacketLossRatio())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + QosImpl otherImpl = (QosImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Qos"); + CodeHelpers.appendValue(helper, "_latency", _latency); + CodeHelpers.appendValue(helper, "_packetDelayVariation", _packetDelayVariation); + CodeHelpers.appendValue(helper, "_packetLossRatio", _packetLossRatio); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/configurable/properties/AdditionalConfigurableProperty.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/configurable/properties/AdditionalConfigurableProperty.java new file mode 100644 index 0000000000000000000000000000000000000000..e835883e0cea71371546c1ba88e1980e61d54091 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/configurable/properties/AdditionalConfigurableProperty.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.configurable.properties; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ConfigurableProperties; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * It provides VNF specific configurable properties that can be modified using the + * ModifyVnfConfiguration operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list additional-configurable-property {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/configurable-properties/additional-configurable-property + * + *

To create instances of this class use {@link AdditionalConfigurablePropertyBuilder}. + * @see AdditionalConfigurablePropertyBuilder + * @see AdditionalConfigurablePropertyKey + * + */ +public interface AdditionalConfigurableProperty + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("additional-configurable-property"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.configurable.properties.AdditionalConfigurableProperty.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + AdditionalConfigurablePropertyKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/configurable/properties/AdditionalConfigurablePropertyBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/configurable/properties/AdditionalConfigurablePropertyBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..02a4b8354a25af35e2f1fef7709fda626b5e513e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/configurable/properties/AdditionalConfigurablePropertyBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.configurable.properties; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link AdditionalConfigurablePropertyBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AdditionalConfigurablePropertyBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AdditionalConfigurablePropertyBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AdditionalConfigurablePropertyBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AdditionalConfigurablePropertyBuilder + * @see Builder + * + */ +public class AdditionalConfigurablePropertyBuilder implements Builder { + + private String _key; + private String _value; + private AdditionalConfigurablePropertyKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AdditionalConfigurablePropertyBuilder() { + } + + public AdditionalConfigurablePropertyBuilder(AdditionalConfigurableProperty base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public AdditionalConfigurablePropertyKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AdditionalConfigurablePropertyBuilder withKey(final AdditionalConfigurablePropertyKey key) { + this.key = key; + return this; + } + + public AdditionalConfigurablePropertyBuilder setKey(final String value) { + this._key = value; + return this; + } + + public AdditionalConfigurablePropertyBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AdditionalConfigurablePropertyBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AdditionalConfigurablePropertyBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AdditionalConfigurablePropertyBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AdditionalConfigurablePropertyBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public AdditionalConfigurableProperty build() { + return new AdditionalConfigurablePropertyImpl(this); + } + + private static final class AdditionalConfigurablePropertyImpl + extends AbstractAugmentable + implements AdditionalConfigurableProperty { + + private final String _key; + private final String _value; + private final AdditionalConfigurablePropertyKey key; + + AdditionalConfigurablePropertyImpl(AdditionalConfigurablePropertyBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new AdditionalConfigurablePropertyKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public AdditionalConfigurablePropertyKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!AdditionalConfigurableProperty.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + AdditionalConfigurableProperty other = (AdditionalConfigurableProperty)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AdditionalConfigurablePropertyImpl otherImpl = (AdditionalConfigurablePropertyImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("AdditionalConfigurableProperty"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/configurable/properties/AdditionalConfigurablePropertyKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/configurable/properties/AdditionalConfigurablePropertyKey.java new file mode 100644 index 0000000000000000000000000000000000000000..efc9f17ca32810a7ef1a067b86e68bb869e0d0f6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/configurable/properties/AdditionalConfigurablePropertyKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.configurable.properties; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class AdditionalConfigurablePropertyKey + implements Identifier { + private static final long serialVersionUID = -4035791184852901377L; + private final String _key; + + + public AdditionalConfigurablePropertyKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public AdditionalConfigurablePropertyKey(AdditionalConfigurablePropertyKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof AdditionalConfigurablePropertyKey)) { + return false; + } + final AdditionalConfigurablePropertyKey other = (AdditionalConfigurablePropertyKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(AdditionalConfigurablePropertyKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/AffinityOrAntiAffinityGroup.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/AffinityOrAntiAffinityGroup.java new file mode 100644 index 0000000000000000000000000000000000000000..a9e71f096c79cc06a5bfd7388bdb7571b8733e2d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/AffinityOrAntiAffinityGroup.java @@ -0,0 +1,99 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityScope; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityType; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The AffinityOrAntiAffinityGroup describes the affinity or anti-affinity + * relationship applicable between the virtualization containers to be created + * based on different VDUs, or between internal VLs to be created based on + * different VnfVirtualLinkDesc(s). Per VNF, the affinity/anti-affinity rules + * defined using this information element, using the + * LocalAffinityOrAntiAffinityRule information element, and using the placement + * constraints in the GrantLifecycleOperation as defined in ETSI GS NFV-IFA 007 + * [i.3] should be conflict-free. In case of conflicts, the placement constraints + * in the GrantLifecycleOperation shall take precedence. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list affinity-or-anti-affinity-group {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf type {
+ *     type affinity-type;
+ *   }
+ *   leaf scope {
+ *     type affinity-scope;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/affinity-or-anti-affinity-group + * + *

To create instances of this class use {@link AffinityOrAntiAffinityGroupBuilder}. + * @see AffinityOrAntiAffinityGroupBuilder + * @see AffinityOrAntiAffinityGroupKey + * + */ +public interface AffinityOrAntiAffinityGroup + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("affinity-or-anti-affinity-group"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.AffinityOrAntiAffinityGroup.class; + } + + /** + * Identifies an affinity or anti-affinity group to which the affinity or + * anti-affinity rule applies. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Specifies whether the rule is an affinity rule or an anti-affinity rule. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityType type, or null if not present + */ + @Nullable AffinityType getType(); + + /** + * Specifies the scope of the rule, possible values are 'NFVI-PoP', 'Zone', + * 'ZoneGroup', 'NFVI-node'. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityScope scope, or null if not present + */ + @Nullable AffinityScope getScope(); + + @Override + AffinityOrAntiAffinityGroupKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/AffinityOrAntiAffinityGroupBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/AffinityOrAntiAffinityGroupBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..cc2b4b1422756b8d74a519cc3878d370b46a759e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/AffinityOrAntiAffinityGroupBuilder.java @@ -0,0 +1,296 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityScope; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.AffinityType; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link AffinityOrAntiAffinityGroupBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AffinityOrAntiAffinityGroupBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AffinityOrAntiAffinityGroupBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AffinityOrAntiAffinityGroupBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AffinityOrAntiAffinityGroupBuilder + * @see Builder + * + */ +public class AffinityOrAntiAffinityGroupBuilder implements Builder { + + private String _id; + private AffinityScope _scope; + private AffinityType _type; + private AffinityOrAntiAffinityGroupKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AffinityOrAntiAffinityGroupBuilder() { + } + + public AffinityOrAntiAffinityGroupBuilder(AffinityOrAntiAffinityGroup base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._scope = base.getScope(); + this._type = base.getType(); + } + + + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + public String getId() { + return _id; + } + + public AffinityScope getScope() { + return _scope; + } + + public AffinityType getType() { + return _type; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AffinityOrAntiAffinityGroupBuilder withKey(final AffinityOrAntiAffinityGroupKey key) { + this.key = key; + return this; + } + + public AffinityOrAntiAffinityGroupBuilder setId(final String value) { + this._id = value; + return this; + } + + public AffinityOrAntiAffinityGroupBuilder setScope(final AffinityScope value) { + this._scope = value; + return this; + } + + public AffinityOrAntiAffinityGroupBuilder setType(final AffinityType value) { + this._type = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AffinityOrAntiAffinityGroupBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AffinityOrAntiAffinityGroupBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public AffinityOrAntiAffinityGroup build() { + return new AffinityOrAntiAffinityGroupImpl(this); + } + + private static final class AffinityOrAntiAffinityGroupImpl + extends AbstractAugmentable + implements AffinityOrAntiAffinityGroup { + + private final String _id; + private final AffinityScope _scope; + private final AffinityType _type; + private final AffinityOrAntiAffinityGroupKey key; + + AffinityOrAntiAffinityGroupImpl(AffinityOrAntiAffinityGroupBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new AffinityOrAntiAffinityGroupKey(base.getId()); + } + this._id = key.getId(); + this._scope = base.getScope(); + this._type = base.getType(); + } + + @Override + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public AffinityScope getScope() { + return _scope; + } + + @Override + public AffinityType getType() { + return _type; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_scope); + result = prime * result + Objects.hashCode(_type); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!AffinityOrAntiAffinityGroup.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + AffinityOrAntiAffinityGroup other = (AffinityOrAntiAffinityGroup)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_scope, other.getScope())) { + return false; + } + if (!Objects.equals(_type, other.getType())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AffinityOrAntiAffinityGroupImpl otherImpl = (AffinityOrAntiAffinityGroupImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("AffinityOrAntiAffinityGroup"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_scope", _scope); + CodeHelpers.appendValue(helper, "_type", _type); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/AffinityOrAntiAffinityGroupKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/AffinityOrAntiAffinityGroupKey.java new file mode 100644 index 0000000000000000000000000000000000000000..3aeda5c34299c4df8ea10fee58f0d99e12a33ee8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/AffinityOrAntiAffinityGroupKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class AffinityOrAntiAffinityGroupKey + implements Identifier { + private static final long serialVersionUID = -4909084403753675647L; + private final String _id; + + + public AffinityOrAntiAffinityGroupKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public AffinityOrAntiAffinityGroupKey(AffinityOrAntiAffinityGroupKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof AffinityOrAntiAffinityGroupKey)) { + return false; + } + final AffinityOrAntiAffinityGroupKey other = (AffinityOrAntiAffinityGroupKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(AffinityOrAntiAffinityGroupKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/Indicator.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/Indicator.java new file mode 100644 index 0000000000000000000000000000000000000000..76580f65fe6da0231b0eb42533865e1569dfb145 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/Indicator.java @@ -0,0 +1,174 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Declares the VNF indicators that are supported by this VNF (specific to this + * DF). + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list indicator {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf indicator-value {
+ *     type string;
+ *   }
+ *   leaf source {
+ *     type enumeration {
+ *       enum vnf;
+ *       enum em;
+ *       enum both;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/indicator + * + *

To create instances of this class use {@link IndicatorBuilder}. + * @see IndicatorBuilder + * @see IndicatorKey + * + */ +public interface Indicator + extends + ChildOf, + Augmentable, + Identifiable +{ + + + public enum Source implements Enumeration { + Vnf(0, "vnf"), + + Em(1, "em"), + + Both(2, "both") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (Source enumItem : Source.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private Source(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding Source item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding Source item, or null if no such item exists + */ + public static Source forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("indicator"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.Indicator.class; + } + + /** + * Unique identifier. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * The human readable name of the VnfIndicator. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Defines the allowed values or value ranges of this indicator. + * + * + * + * @return java.lang.String indicatorValue, or null if not present + */ + @Nullable String getIndicatorValue(); + + /** + * Describe the source of the indicator. The possible values are: • VNF. • EM. • + * Both. This tells the consumer where to send the subscription request. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.Indicator.Source source, or null if not present + */ + @Nullable Source getSource(); + + @Override + IndicatorKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/IndicatorBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/IndicatorBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..f3e37a14aca874cf16c0c78393a90a42c1940b76 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/IndicatorBuilder.java @@ -0,0 +1,317 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link IndicatorBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     IndicatorBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new IndicatorBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of IndicatorBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see IndicatorBuilder + * @see Builder + * + */ +public class IndicatorBuilder implements Builder { + + private String _id; + private String _indicatorValue; + private String _name; + private Indicator.Source _source; + private IndicatorKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public IndicatorBuilder() { + } + + public IndicatorBuilder(Indicator base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._indicatorValue = base.getIndicatorValue(); + this._name = base.getName(); + this._source = base.getSource(); + } + + + public IndicatorKey key() { + return key; + } + + public String getId() { + return _id; + } + + public String getIndicatorValue() { + return _indicatorValue; + } + + public String getName() { + return _name; + } + + public Indicator.Source getSource() { + return _source; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public IndicatorBuilder withKey(final IndicatorKey key) { + this.key = key; + return this; + } + + public IndicatorBuilder setId(final String value) { + this._id = value; + return this; + } + + public IndicatorBuilder setIndicatorValue(final String value) { + this._indicatorValue = value; + return this; + } + + public IndicatorBuilder setName(final String value) { + this._name = value; + return this; + } + + public IndicatorBuilder setSource(final Indicator.Source value) { + this._source = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public IndicatorBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public IndicatorBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public IndicatorBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private IndicatorBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Indicator build() { + return new IndicatorImpl(this); + } + + private static final class IndicatorImpl + extends AbstractAugmentable + implements Indicator { + + private final String _id; + private final String _indicatorValue; + private final String _name; + private final Indicator.Source _source; + private final IndicatorKey key; + + IndicatorImpl(IndicatorBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new IndicatorKey(base.getId()); + } + this._id = key.getId(); + this._indicatorValue = base.getIndicatorValue(); + this._name = base.getName(); + this._source = base.getSource(); + } + + @Override + public IndicatorKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getIndicatorValue() { + return _indicatorValue; + } + + @Override + public String getName() { + return _name; + } + + @Override + public Indicator.Source getSource() { + return _source; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_indicatorValue); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_source); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Indicator.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Indicator other = (Indicator)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_indicatorValue, other.getIndicatorValue())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_source, other.getSource())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + IndicatorImpl otherImpl = (IndicatorImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Indicator"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_indicatorValue", _indicatorValue); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_source", _source); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/IndicatorKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/IndicatorKey.java new file mode 100644 index 0000000000000000000000000000000000000000..327675562973e5d61eff802f320173c4491d588f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/IndicatorKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class IndicatorKey + implements Identifier { + private static final long serialVersionUID = 2687907149552019284L; + private final String _id; + + + public IndicatorKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public IndicatorKey(IndicatorKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof IndicatorKey)) { + return false; + } + final IndicatorKey other = (IndicatorKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(IndicatorKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/InstantiationLevel.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/InstantiationLevel.java new file mode 100644 index 0000000000000000000000000000000000000000..8062017dfc89d1c072936991c5b55dd556d9d9fd --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/InstantiationLevel.java @@ -0,0 +1,149 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level.ScalingInfo; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level.ScalingInfoKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level.VduLevel; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level.VduLevelKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Describes the various levels of resources that can be used to instantiate the + * VNF using this flavour. Examples: Small, Medium, Large. If there is only one + * 'instantiationLevel' entry, it shall be treated as the default instantiation + * level for this DF. The InstantiationLevel information element describes a given + * level of resources to be instantiated within a deployment flavour in term of + * number of VNFC instances to be created from each VDU. All the VDUs referenced + * the level shall be part of the corresponding deployment flavour and their + * shall be within the range (min/max) for this deployment flavour. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list instantiation-level {
+ *   key id;
+ *   min-elements 1;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   list vdu-level {
+ *     key vdu-id;
+ *     min-elements 1;
+ *     leaf vdu-id {
+ *       type leafref {
+ *         path ../../../../vdu/id;
+ *       }
+ *     }
+ *     leaf number-of-instances {
+ *       type uint16;
+ *       must ". <= ../../../../df/vdu-profile[id=current()/../vdu-id]/max-number-of-instances";
+ *       must ". >= ../../../../df/vdu-profile[id=current()/../vdu-id]/min-number-of-instances";
+ *       default 1;
+ *     }
+ *   }
+ *   list scaling-info {
+ *     key scaling-aspect-id;
+ *     leaf scaling-aspect-id {
+ *       type leafref {
+ *         path ../../../scaling-aspect/id;
+ *       }
+ *     }
+ *     leaf scale-level {
+ *       type uint32;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/instantiation-level + * + *

To create instances of this class use {@link InstantiationLevelBuilder}. + * @see InstantiationLevelBuilder + * @see InstantiationLevelKey + * + */ +public interface InstantiationLevel + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("instantiation-level"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.InstantiationLevel.class; + } + + /** + * Uniquely identifies a level with the DF. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Human readable description of the instantiation level + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * Sets the number of instances for the VDU in this instantiation level. + * + * + * + * @return java.util.Map vduLevel, or null if not present + */ + @Nullable Map getVduLevel(); + + /** + * @return java.util.Map vduLevel, or an empty list if it is not present + */ + default @NonNull Map nonnullVduLevel() { + return CodeHelpers.nonnull(getVduLevel()); + } + + /** + * The InstantiationLevel information element describes a given level of resources + * to be instantiated within a DF in term of the number of VNFC instances to be + * created from each VDU. + * + * + * + * @return java.util.Map scalingInfo, or null if not present + */ + @Nullable Map getScalingInfo(); + + /** + * @return java.util.Map scalingInfo, or an empty list if it is not present + */ + default @NonNull Map nonnullScalingInfo() { + return CodeHelpers.nonnull(getScalingInfo()); + } + + @Override + InstantiationLevelKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/InstantiationLevelBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/InstantiationLevelBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..919665a410e19be9d76e2952d8e99d2322a92d9e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/InstantiationLevelBuilder.java @@ -0,0 +1,356 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level.ScalingInfo; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level.ScalingInfoKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level.VduLevel; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level.VduLevelKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link InstantiationLevelBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     InstantiationLevelBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new InstantiationLevelBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of InstantiationLevelBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see InstantiationLevelBuilder + * @see Builder + * + */ +public class InstantiationLevelBuilder implements Builder { + + private String _description; + private String _id; + private Map _scalingInfo; + private Map _vduLevel; + private InstantiationLevelKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public InstantiationLevelBuilder() { + } + + public InstantiationLevelBuilder(InstantiationLevel base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._description = base.getDescription(); + this._scalingInfo = base.getScalingInfo(); + this._vduLevel = base.getVduLevel(); + } + + + public InstantiationLevelKey key() { + return key; + } + + public String getDescription() { + return _description; + } + + public String getId() { + return _id; + } + + public Map getScalingInfo() { + return _scalingInfo; + } + + public Map getVduLevel() { + return _vduLevel; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public InstantiationLevelBuilder withKey(final InstantiationLevelKey key) { + this.key = key; + return this; + } + + public InstantiationLevelBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public InstantiationLevelBuilder setId(final String value) { + this._id = value; + return this; + } + public InstantiationLevelBuilder setScalingInfo(final Map values) { + this._scalingInfo = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setScalingInfo(Map)} instead. + */ + @Deprecated(forRemoval = true) + public InstantiationLevelBuilder setScalingInfo(final List values) { + return setScalingInfo(CodeHelpers.compatMap(values)); + } + public InstantiationLevelBuilder setVduLevel(final Map values) { + this._vduLevel = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVduLevel(Map)} instead. + */ + @Deprecated(forRemoval = true) + public InstantiationLevelBuilder setVduLevel(final List values) { + return setVduLevel(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public InstantiationLevelBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public InstantiationLevelBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public InstantiationLevelBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private InstantiationLevelBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public InstantiationLevel build() { + return new InstantiationLevelImpl(this); + } + + private static final class InstantiationLevelImpl + extends AbstractAugmentable + implements InstantiationLevel { + + private final String _description; + private final String _id; + private final Map _scalingInfo; + private final Map _vduLevel; + private final InstantiationLevelKey key; + + InstantiationLevelImpl(InstantiationLevelBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new InstantiationLevelKey(base.getId()); + } + this._id = key.getId(); + this._description = base.getDescription(); + this._scalingInfo = CodeHelpers.emptyToNull(base.getScalingInfo()); + this._vduLevel = CodeHelpers.emptyToNull(base.getVduLevel()); + } + + @Override + public InstantiationLevelKey key() { + return key; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getScalingInfo() { + return _scalingInfo; + } + + @Override + public Map getVduLevel() { + return _vduLevel; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_scalingInfo); + result = prime * result + Objects.hashCode(_vduLevel); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!InstantiationLevel.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + InstantiationLevel other = (InstantiationLevel)obj; + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_scalingInfo, other.getScalingInfo())) { + return false; + } + if (!Objects.equals(_vduLevel, other.getVduLevel())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + InstantiationLevelImpl otherImpl = (InstantiationLevelImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("InstantiationLevel"); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_scalingInfo", _scalingInfo); + CodeHelpers.appendValue(helper, "_vduLevel", _vduLevel); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/InstantiationLevelKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/InstantiationLevelKey.java new file mode 100644 index 0000000000000000000000000000000000000000..3a8e870f4b5f51e04aaec7f1be2fccb28213cc64 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/InstantiationLevelKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class InstantiationLevelKey + implements Identifier { + private static final long serialVersionUID = -861901485313746004L; + private final String _id; + + + public InstantiationLevelKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public InstantiationLevelKey(InstantiationLevelKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof InstantiationLevelKey)) { + return false; + } + final InstantiationLevelKey other = (InstantiationLevelKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(InstantiationLevelKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/LcmOperationsConfiguration.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/LcmOperationsConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..441316f9eea8ff2291c33a6702724bbfa44f97a3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/LcmOperationsConfiguration.java @@ -0,0 +1,241 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ChangeExtVnfConnectivityOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ChangeVnfFlavourOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.HealVnfOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.InstantiateVnfOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.OperateVnfOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ScaleVnfOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ScaleVnfToLevelOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.TerminateVnfOpConfig; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This information element is a container for all attributes that affect the + * invocation of the VNF Lifecycle Management operations, structured by operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container lcm-operations-configuration {
+ *   container instantiate-vnf-op-config {
+ *     list parameter {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   container scale-vnf-op-config {
+ *     list parameter {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *     leaf scaling-by-more-than-one-step-supported {
+ *       type boolean;
+ *       default false;
+ *     }
+ *   }
+ *   container scale-vnf-to-level-op-config {
+ *     list parameter {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *     leaf arbitrary-target-levels-supported {
+ *       type boolean;
+ *       default false;
+ *     }
+ *   }
+ *   container heal-vnf-op-config {
+ *     list parameter {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *     leaf-list cause {
+ *       type string;
+ *     }
+ *   }
+ *   container terminate-vnf-op-config {
+ *     leaf min-graceful-termination {
+ *       type yang:timeticks;
+ *       default 1;
+ *     }
+ *     leaf max-recommended-graceful-termination {
+ *       type yang:timeticks;
+ *     }
+ *     list parameter {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   container operate-vnf-op-config {
+ *     leaf min-graceful-stop-timeout {
+ *       type yang:timeticks;
+ *       default 1;
+ *     }
+ *     leaf max-recommended-graceful-stop-timeout {
+ *       type yang:timeticks;
+ *     }
+ *     list parameter {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   container change-vnf-flavour-op-config {
+ *     list parameter {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   container change-ext-vnf-connectivity-op-config {
+ *     list parameter {
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration + * + *

To create instances of this class use {@link LcmOperationsConfigurationBuilder}. + * @see LcmOperationsConfigurationBuilder + * + */ +public interface LcmOperationsConfiguration + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("lcm-operations-configuration"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration.class; + } + + /** + * Configuration parameters for the InstantiateVnf operation. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.InstantiateVnfOpConfig instantiateVnfOpConfig, or null if not present + */ + @Nullable InstantiateVnfOpConfig getInstantiateVnfOpConfig(); + + /** + * Configuration parameters for the ScaleVnf operation. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ScaleVnfOpConfig scaleVnfOpConfig, or null if not present + */ + @Nullable ScaleVnfOpConfig getScaleVnfOpConfig(); + + /** + * This information element defines attributes that affect the invocation of the + * ScaleVnfToLevel operation. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ScaleVnfToLevelOpConfig scaleVnfToLevelOpConfig, or null if not present + */ + @Nullable ScaleVnfToLevelOpConfig getScaleVnfToLevelOpConfig(); + + /** + * This information element defines attributes that affect the invocation of the + * HealVnf operation. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.HealVnfOpConfig healVnfOpConfig, or null if not present + */ + @Nullable HealVnfOpConfig getHealVnfOpConfig(); + + /** + * This information element defines attributes that affect the invocation of the + * TerminateVnf operation. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.TerminateVnfOpConfig terminateVnfOpConfig, or null if not present + */ + @Nullable TerminateVnfOpConfig getTerminateVnfOpConfig(); + + /** + * This information element defines attributes that affect the invocation of the + * OperateVnf operation. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.OperateVnfOpConfig operateVnfOpConfig, or null if not present + */ + @Nullable OperateVnfOpConfig getOperateVnfOpConfig(); + + /** + * Configuration parameters for the ChangeVnfFlavour operation. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ChangeVnfFlavourOpConfig changeVnfFlavourOpConfig, or null if not present + */ + @Nullable ChangeVnfFlavourOpConfig getChangeVnfFlavourOpConfig(); + + /** + * Configuration parameters for the ChangeExtVnfConnectivity operation. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ChangeExtVnfConnectivityOpConfig changeExtVnfConnectivityOpConfig, or null if not present + */ + @Nullable ChangeExtVnfConnectivityOpConfig getChangeExtVnfConnectivityOpConfig(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/LcmOperationsConfigurationBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/LcmOperationsConfigurationBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..6f4f4d12c9889e28c7ae230951ae301398c21b92 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/LcmOperationsConfigurationBuilder.java @@ -0,0 +1,396 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ChangeExtVnfConnectivityOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ChangeVnfFlavourOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.HealVnfOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.InstantiateVnfOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.OperateVnfOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ScaleVnfOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ScaleVnfToLevelOpConfig; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.TerminateVnfOpConfig; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link LcmOperationsConfigurationBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     LcmOperationsConfigurationBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new LcmOperationsConfigurationBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of LcmOperationsConfigurationBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see LcmOperationsConfigurationBuilder + * @see Builder + * + */ +public class LcmOperationsConfigurationBuilder implements Builder { + + private ChangeExtVnfConnectivityOpConfig _changeExtVnfConnectivityOpConfig; + private ChangeVnfFlavourOpConfig _changeVnfFlavourOpConfig; + private HealVnfOpConfig _healVnfOpConfig; + private InstantiateVnfOpConfig _instantiateVnfOpConfig; + private OperateVnfOpConfig _operateVnfOpConfig; + private ScaleVnfOpConfig _scaleVnfOpConfig; + private ScaleVnfToLevelOpConfig _scaleVnfToLevelOpConfig; + private TerminateVnfOpConfig _terminateVnfOpConfig; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public LcmOperationsConfigurationBuilder() { + } + + public LcmOperationsConfigurationBuilder(LcmOperationsConfiguration base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._changeExtVnfConnectivityOpConfig = base.getChangeExtVnfConnectivityOpConfig(); + this._changeVnfFlavourOpConfig = base.getChangeVnfFlavourOpConfig(); + this._healVnfOpConfig = base.getHealVnfOpConfig(); + this._instantiateVnfOpConfig = base.getInstantiateVnfOpConfig(); + this._operateVnfOpConfig = base.getOperateVnfOpConfig(); + this._scaleVnfOpConfig = base.getScaleVnfOpConfig(); + this._scaleVnfToLevelOpConfig = base.getScaleVnfToLevelOpConfig(); + this._terminateVnfOpConfig = base.getTerminateVnfOpConfig(); + } + + + public ChangeExtVnfConnectivityOpConfig getChangeExtVnfConnectivityOpConfig() { + return _changeExtVnfConnectivityOpConfig; + } + + public ChangeVnfFlavourOpConfig getChangeVnfFlavourOpConfig() { + return _changeVnfFlavourOpConfig; + } + + public HealVnfOpConfig getHealVnfOpConfig() { + return _healVnfOpConfig; + } + + public InstantiateVnfOpConfig getInstantiateVnfOpConfig() { + return _instantiateVnfOpConfig; + } + + public OperateVnfOpConfig getOperateVnfOpConfig() { + return _operateVnfOpConfig; + } + + public ScaleVnfOpConfig getScaleVnfOpConfig() { + return _scaleVnfOpConfig; + } + + public ScaleVnfToLevelOpConfig getScaleVnfToLevelOpConfig() { + return _scaleVnfToLevelOpConfig; + } + + public TerminateVnfOpConfig getTerminateVnfOpConfig() { + return _terminateVnfOpConfig; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public LcmOperationsConfigurationBuilder setChangeExtVnfConnectivityOpConfig(final ChangeExtVnfConnectivityOpConfig value) { + this._changeExtVnfConnectivityOpConfig = value; + return this; + } + + public LcmOperationsConfigurationBuilder setChangeVnfFlavourOpConfig(final ChangeVnfFlavourOpConfig value) { + this._changeVnfFlavourOpConfig = value; + return this; + } + + public LcmOperationsConfigurationBuilder setHealVnfOpConfig(final HealVnfOpConfig value) { + this._healVnfOpConfig = value; + return this; + } + + public LcmOperationsConfigurationBuilder setInstantiateVnfOpConfig(final InstantiateVnfOpConfig value) { + this._instantiateVnfOpConfig = value; + return this; + } + + public LcmOperationsConfigurationBuilder setOperateVnfOpConfig(final OperateVnfOpConfig value) { + this._operateVnfOpConfig = value; + return this; + } + + public LcmOperationsConfigurationBuilder setScaleVnfOpConfig(final ScaleVnfOpConfig value) { + this._scaleVnfOpConfig = value; + return this; + } + + public LcmOperationsConfigurationBuilder setScaleVnfToLevelOpConfig(final ScaleVnfToLevelOpConfig value) { + this._scaleVnfToLevelOpConfig = value; + return this; + } + + public LcmOperationsConfigurationBuilder setTerminateVnfOpConfig(final TerminateVnfOpConfig value) { + this._terminateVnfOpConfig = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public LcmOperationsConfigurationBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public LcmOperationsConfigurationBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public LcmOperationsConfigurationBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private LcmOperationsConfigurationBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public LcmOperationsConfiguration build() { + return new LcmOperationsConfigurationImpl(this); + } + + private static final class LcmOperationsConfigurationImpl + extends AbstractAugmentable + implements LcmOperationsConfiguration { + + private final ChangeExtVnfConnectivityOpConfig _changeExtVnfConnectivityOpConfig; + private final ChangeVnfFlavourOpConfig _changeVnfFlavourOpConfig; + private final HealVnfOpConfig _healVnfOpConfig; + private final InstantiateVnfOpConfig _instantiateVnfOpConfig; + private final OperateVnfOpConfig _operateVnfOpConfig; + private final ScaleVnfOpConfig _scaleVnfOpConfig; + private final ScaleVnfToLevelOpConfig _scaleVnfToLevelOpConfig; + private final TerminateVnfOpConfig _terminateVnfOpConfig; + + LcmOperationsConfigurationImpl(LcmOperationsConfigurationBuilder base) { + super(base.augmentation); + this._changeExtVnfConnectivityOpConfig = base.getChangeExtVnfConnectivityOpConfig(); + this._changeVnfFlavourOpConfig = base.getChangeVnfFlavourOpConfig(); + this._healVnfOpConfig = base.getHealVnfOpConfig(); + this._instantiateVnfOpConfig = base.getInstantiateVnfOpConfig(); + this._operateVnfOpConfig = base.getOperateVnfOpConfig(); + this._scaleVnfOpConfig = base.getScaleVnfOpConfig(); + this._scaleVnfToLevelOpConfig = base.getScaleVnfToLevelOpConfig(); + this._terminateVnfOpConfig = base.getTerminateVnfOpConfig(); + } + + @Override + public ChangeExtVnfConnectivityOpConfig getChangeExtVnfConnectivityOpConfig() { + return _changeExtVnfConnectivityOpConfig; + } + + @Override + public ChangeVnfFlavourOpConfig getChangeVnfFlavourOpConfig() { + return _changeVnfFlavourOpConfig; + } + + @Override + public HealVnfOpConfig getHealVnfOpConfig() { + return _healVnfOpConfig; + } + + @Override + public InstantiateVnfOpConfig getInstantiateVnfOpConfig() { + return _instantiateVnfOpConfig; + } + + @Override + public OperateVnfOpConfig getOperateVnfOpConfig() { + return _operateVnfOpConfig; + } + + @Override + public ScaleVnfOpConfig getScaleVnfOpConfig() { + return _scaleVnfOpConfig; + } + + @Override + public ScaleVnfToLevelOpConfig getScaleVnfToLevelOpConfig() { + return _scaleVnfToLevelOpConfig; + } + + @Override + public TerminateVnfOpConfig getTerminateVnfOpConfig() { + return _terminateVnfOpConfig; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_changeExtVnfConnectivityOpConfig); + result = prime * result + Objects.hashCode(_changeVnfFlavourOpConfig); + result = prime * result + Objects.hashCode(_healVnfOpConfig); + result = prime * result + Objects.hashCode(_instantiateVnfOpConfig); + result = prime * result + Objects.hashCode(_operateVnfOpConfig); + result = prime * result + Objects.hashCode(_scaleVnfOpConfig); + result = prime * result + Objects.hashCode(_scaleVnfToLevelOpConfig); + result = prime * result + Objects.hashCode(_terminateVnfOpConfig); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!LcmOperationsConfiguration.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + LcmOperationsConfiguration other = (LcmOperationsConfiguration)obj; + if (!Objects.equals(_changeExtVnfConnectivityOpConfig, other.getChangeExtVnfConnectivityOpConfig())) { + return false; + } + if (!Objects.equals(_changeVnfFlavourOpConfig, other.getChangeVnfFlavourOpConfig())) { + return false; + } + if (!Objects.equals(_healVnfOpConfig, other.getHealVnfOpConfig())) { + return false; + } + if (!Objects.equals(_instantiateVnfOpConfig, other.getInstantiateVnfOpConfig())) { + return false; + } + if (!Objects.equals(_operateVnfOpConfig, other.getOperateVnfOpConfig())) { + return false; + } + if (!Objects.equals(_scaleVnfOpConfig, other.getScaleVnfOpConfig())) { + return false; + } + if (!Objects.equals(_scaleVnfToLevelOpConfig, other.getScaleVnfToLevelOpConfig())) { + return false; + } + if (!Objects.equals(_terminateVnfOpConfig, other.getTerminateVnfOpConfig())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + LcmOperationsConfigurationImpl otherImpl = (LcmOperationsConfigurationImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("LcmOperationsConfiguration"); + CodeHelpers.appendValue(helper, "_changeExtVnfConnectivityOpConfig", _changeExtVnfConnectivityOpConfig); + CodeHelpers.appendValue(helper, "_changeVnfFlavourOpConfig", _changeVnfFlavourOpConfig); + CodeHelpers.appendValue(helper, "_healVnfOpConfig", _healVnfOpConfig); + CodeHelpers.appendValue(helper, "_instantiateVnfOpConfig", _instantiateVnfOpConfig); + CodeHelpers.appendValue(helper, "_operateVnfOpConfig", _operateVnfOpConfig); + CodeHelpers.appendValue(helper, "_scaleVnfOpConfig", _scaleVnfOpConfig); + CodeHelpers.appendValue(helper, "_scaleVnfToLevelOpConfig", _scaleVnfToLevelOpConfig); + CodeHelpers.appendValue(helper, "_terminateVnfOpConfig", _terminateVnfOpConfig); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/MonitoringParameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/MonitoringParameter.java new file mode 100644 index 0000000000000000000000000000000000000000..8b52ec4b60fbe4333c52af9cd4337ea35bfbf3f0 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/MonitoringParameter.java @@ -0,0 +1,65 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Defines the virtualised resources monitoring parameters on VNF level. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list monitoring-parameter {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   uses monitoring-parameter;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/monitoring-parameter + * + *

To create instances of this class use {@link MonitoringParameterBuilder}. + * @see MonitoringParameterBuilder + * @see MonitoringParameterKey + * + */ +public interface MonitoringParameter + extends + ChildOf, + Augmentable, + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("monitoring-parameter"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.MonitoringParameter.class; + } + + /** + * Unique identifier of the monitoring parameter. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + @Override + MonitoringParameterKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/MonitoringParameterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/MonitoringParameterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..509314539cb73997f5000cc3e886ba60bafdacae --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/MonitoringParameterBuilder.java @@ -0,0 +1,355 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link MonitoringParameterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     MonitoringParameterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new MonitoringParameterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of MonitoringParameterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see MonitoringParameterBuilder + * @see Builder + * + */ +public class MonitoringParameterBuilder implements Builder { + + private Uint64 _collectionPeriod; + private String _id; + private String _name; + private String _performanceMetric; + private MonitoringParameterKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public MonitoringParameterBuilder() { + } + public MonitoringParameterBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter arg) { + this._name = arg.getName(); + this._performanceMetric = arg.getPerformanceMetric(); + this._collectionPeriod = arg.getCollectionPeriod(); + } + + public MonitoringParameterBuilder(MonitoringParameter base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._collectionPeriod = base.getCollectionPeriod(); + this._name = base.getName(); + this._performanceMetric = base.getPerformanceMetric(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter) { + this._name = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter)arg).getName(); + this._performanceMetric = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter)arg).getPerformanceMetric(); + this._collectionPeriod = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter)arg).getCollectionPeriod(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter]"); + } + + public MonitoringParameterKey key() { + return key; + } + + public Uint64 getCollectionPeriod() { + return _collectionPeriod; + } + + public String getId() { + return _id; + } + + public String getName() { + return _name; + } + + public String getPerformanceMetric() { + return _performanceMetric; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public MonitoringParameterBuilder withKey(final MonitoringParameterKey key) { + this.key = key; + return this; + } + + public MonitoringParameterBuilder setCollectionPeriod(final Uint64 value) { + this._collectionPeriod = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setCollectionPeriod(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public MonitoringParameterBuilder setCollectionPeriod(final BigInteger value) { + return setCollectionPeriod(CodeHelpers.compatUint(value)); + } + + public MonitoringParameterBuilder setId(final String value) { + this._id = value; + return this; + } + + public MonitoringParameterBuilder setName(final String value) { + this._name = value; + return this; + } + + public MonitoringParameterBuilder setPerformanceMetric(final String value) { + this._performanceMetric = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public MonitoringParameterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public MonitoringParameterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public MonitoringParameterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private MonitoringParameterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public MonitoringParameter build() { + return new MonitoringParameterImpl(this); + } + + private static final class MonitoringParameterImpl + extends AbstractAugmentable + implements MonitoringParameter { + + private final Uint64 _collectionPeriod; + private final String _id; + private final String _name; + private final String _performanceMetric; + private final MonitoringParameterKey key; + + MonitoringParameterImpl(MonitoringParameterBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new MonitoringParameterKey(base.getId()); + } + this._id = key.getId(); + this._collectionPeriod = base.getCollectionPeriod(); + this._name = base.getName(); + this._performanceMetric = base.getPerformanceMetric(); + } + + @Override + public MonitoringParameterKey key() { + return key; + } + + @Override + public Uint64 getCollectionPeriod() { + return _collectionPeriod; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getName() { + return _name; + } + + @Override + public String getPerformanceMetric() { + return _performanceMetric; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_collectionPeriod); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_performanceMetric); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!MonitoringParameter.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + MonitoringParameter other = (MonitoringParameter)obj; + if (!Objects.equals(_collectionPeriod, other.getCollectionPeriod())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_performanceMetric, other.getPerformanceMetric())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + MonitoringParameterImpl otherImpl = (MonitoringParameterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("MonitoringParameter"); + CodeHelpers.appendValue(helper, "_collectionPeriod", _collectionPeriod); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_performanceMetric", _performanceMetric); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/MonitoringParameterKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/MonitoringParameterKey.java new file mode 100644 index 0000000000000000000000000000000000000000..8c31fec39917c62baeb1d500c87c69d0db0ee7a7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/MonitoringParameterKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class MonitoringParameterKey + implements Identifier { + private static final long serialVersionUID = 7526161979845181524L; + private final String _id; + + + public MonitoringParameterKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public MonitoringParameterKey(MonitoringParameterKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof MonitoringParameterKey)) { + return false; + } + final MonitoringParameterKey other = (MonitoringParameterKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(MonitoringParameterKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/ScalingAspect.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/ScalingAspect.java new file mode 100644 index 0000000000000000000000000000000000000000..4aa767efd49396ed17faec449defe6a9be7fa9f7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/ScalingAspect.java @@ -0,0 +1,165 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.AspectDeltaDetails; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * The scaling aspects supported by this DF of the VNF. scalingAspect shall be + * present if the VNF supports scaling. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list scaling-aspect {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   leaf max-scale-level {
+ *     type uint32 {
+ *       range 1..max;
+ *     }
+ *   }
+ *   container aspect-delta-details {
+ *     list deltas {
+ *       key id;
+ *       min-elements 1;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       list vdu-delta {
+ *         key id;
+ *         leaf id {
+ *           type leafref {
+ *             path ../../../../../../vdu/id;
+ *           }
+ *         }
+ *         leaf number-of-instances {
+ *           type uint32 {
+ *             range 0..max;
+ *           }
+ *         }
+ *       }
+ *       list virtual-link-bit-rate-delta {
+ *         key id;
+ *         leaf id {
+ *           type string;
+ *         }
+ *         container bit-rate-requirements {
+ *           leaf root {
+ *             type uint32;
+ *             units bits/sec;
+ *           }
+ *           leaf leaf {
+ *             type uint32;
+ *             units bits/sec;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     leaf step-deltas {
+ *       type leafref {
+ *         path ../deltas/id;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/scaling-aspect + * + *

To create instances of this class use {@link ScalingAspectBuilder}. + * @see ScalingAspectBuilder + * @see ScalingAspectKey + * + */ +public interface ScalingAspect + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("scaling-aspect"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.ScalingAspect.class; + } + + /** + * Unique identifier of this aspect in the VNFD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Human readable name of the aspect. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Human readable description of the aspect. + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * The maximum scaleLevel for total number of scaling steps that can be applied + * w.r.t. this aspect. The value of this attribute corresponds to the number of + * scaling steps can be applied to this aspect when scaling it from the minimum + * scale level (i.e. 0) to the maximum scale level defined by this attribute. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 maxScaleLevel, or null if not present + */ + @Nullable Uint32 getMaxScaleLevel(); + + /** + * A specification of the deltas in terms of number of instances of VNFCs and + * virtual link bit rates that correspond to the scaling steps of this aspect. A + * cardinality of zero indicates that this mapping has to be specified in a + * lifecycle management script or be otherwise known to the VNFM. The information + * in this attribute, if provided, shall be consistent with the information + * provided in the 'InstantiationLevel' information element. If this attribute is + * provided, it shall be provided for all scaling aspects. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.AspectDeltaDetails aspectDeltaDetails, or null if not present + */ + @Nullable AspectDeltaDetails getAspectDeltaDetails(); + + @Override + ScalingAspectKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/ScalingAspectBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/ScalingAspectBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..9e37d5664362a5938787d151f9716e168c750049 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/ScalingAspectBuilder.java @@ -0,0 +1,366 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.AspectDeltaDetails; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link ScalingAspectBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ScalingAspectBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ScalingAspectBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ScalingAspectBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ScalingAspectBuilder + * @see Builder + * + */ +public class ScalingAspectBuilder implements Builder { + + private AspectDeltaDetails _aspectDeltaDetails; + private String _description; + private String _id; + private Uint32 _maxScaleLevel; + private String _name; + private ScalingAspectKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ScalingAspectBuilder() { + } + + public ScalingAspectBuilder(ScalingAspect base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._aspectDeltaDetails = base.getAspectDeltaDetails(); + this._description = base.getDescription(); + this._maxScaleLevel = base.getMaxScaleLevel(); + this._name = base.getName(); + } + + + public ScalingAspectKey key() { + return key; + } + + public AspectDeltaDetails getAspectDeltaDetails() { + return _aspectDeltaDetails; + } + + public String getDescription() { + return _description; + } + + public String getId() { + return _id; + } + + public Uint32 getMaxScaleLevel() { + return _maxScaleLevel; + } + + public String getName() { + return _name; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ScalingAspectBuilder withKey(final ScalingAspectKey key) { + this.key = key; + return this; + } + + public ScalingAspectBuilder setAspectDeltaDetails(final AspectDeltaDetails value) { + this._aspectDeltaDetails = value; + return this; + } + + public ScalingAspectBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public ScalingAspectBuilder setId(final String value) { + this._id = value; + return this; + } + + private static void checkMaxScaleLevelRange(final long value) { + if (value >= 1L) { + return; + } + CodeHelpers.throwInvalidRange("[[1..4294967295]]", value); + } + + public ScalingAspectBuilder setMaxScaleLevel(final Uint32 value) { + if (value != null) { + checkMaxScaleLevelRange(value.longValue()); + + } + this._maxScaleLevel = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setMaxScaleLevel(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public ScalingAspectBuilder setMaxScaleLevel(final Long value) { + return setMaxScaleLevel(CodeHelpers.compatUint(value)); + } + + public ScalingAspectBuilder setName(final String value) { + this._name = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ScalingAspectBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ScalingAspectBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ScalingAspectBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ScalingAspectBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ScalingAspect build() { + return new ScalingAspectImpl(this); + } + + private static final class ScalingAspectImpl + extends AbstractAugmentable + implements ScalingAspect { + + private final AspectDeltaDetails _aspectDeltaDetails; + private final String _description; + private final String _id; + private final Uint32 _maxScaleLevel; + private final String _name; + private final ScalingAspectKey key; + + ScalingAspectImpl(ScalingAspectBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ScalingAspectKey(base.getId()); + } + this._id = key.getId(); + this._aspectDeltaDetails = base.getAspectDeltaDetails(); + this._description = base.getDescription(); + this._maxScaleLevel = base.getMaxScaleLevel(); + this._name = base.getName(); + } + + @Override + public ScalingAspectKey key() { + return key; + } + + @Override + public AspectDeltaDetails getAspectDeltaDetails() { + return _aspectDeltaDetails; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Uint32 getMaxScaleLevel() { + return _maxScaleLevel; + } + + @Override + public String getName() { + return _name; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_aspectDeltaDetails); + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_maxScaleLevel); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ScalingAspect.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ScalingAspect other = (ScalingAspect)obj; + if (!Objects.equals(_aspectDeltaDetails, other.getAspectDeltaDetails())) { + return false; + } + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_maxScaleLevel, other.getMaxScaleLevel())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ScalingAspectImpl otherImpl = (ScalingAspectImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ScalingAspect"); + CodeHelpers.appendValue(helper, "_aspectDeltaDetails", _aspectDeltaDetails); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_maxScaleLevel", _maxScaleLevel); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/ScalingAspectKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/ScalingAspectKey.java new file mode 100644 index 0000000000000000000000000000000000000000..bd62e2c4cc44bd6506501d31b61647703253a78e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/ScalingAspectKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ScalingAspectKey + implements Identifier { + private static final long serialVersionUID = 2014464420224184770L; + private final String _id; + + + public ScalingAspectKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ScalingAspectKey(ScalingAspectKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ScalingAspectKey)) { + return false; + } + final ScalingAspectKey other = (ScalingAspectKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ScalingAspectKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/SupportedVnfInterfaces.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/SupportedVnfInterfaces.java new file mode 100644 index 0000000000000000000000000000000000000000..f5314f70d40e8fd370921ab7a9cb2bd8d47f3721 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/SupportedVnfInterfaces.java @@ -0,0 +1,175 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.supported.vnf.interfaces.InterfaceDetails; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.supported.vnf.interfaces.InterfaceDetailsKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Indicates which interfaces the VNF produces and provides additional details on + * how to access the interface endpoints. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list supported-vnf-interfaces {
+ *   key name;
+ *   leaf name {
+ *     type enumeration {
+ *       enum vnf-configuration;
+ *       enum vnf-indicator;
+ *     }
+ *   }
+ *   leaf-list cpd-id {
+ *     type leafref {
+ *       path ../../../ext-cpd/id;
+ *     }
+ *   }
+ *   list interface-details {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/supported-vnf-interfaces + * + *

To create instances of this class use {@link SupportedVnfInterfacesBuilder}. + * @see SupportedVnfInterfacesBuilder + * @see SupportedVnfInterfacesKey + * + */ +public interface SupportedVnfInterfaces + extends + ChildOf, + Augmentable, + Identifiable +{ + + + public enum Name implements Enumeration { + VnfConfiguration(0, "vnf-configuration"), + + VnfIndicator(1, "vnf-indicator") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (Name enumItem : Name.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private Name(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding Name item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding Name item, or null if no such item exists + */ + public static Name forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("supported-vnf-interfaces"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.SupportedVnfInterfaces.class; + } + + /** + * Identifies an interface produced by the VNF. Valid values: - VNF_CONFIGURATION - + * VNF_INDICATOR + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.SupportedVnfInterfaces.Name name, or null if not present + */ + @Nullable Name getName(); + + /** + * References one or more CPDs from which to instantiate external CPs through which + * interface endpoints on the VNF side can be reached by the VNFM. + * + * + * + * @return java.util.List cpdId, or null if not present + */ + @Nullable List getCpdId(); + + /** + * @return java.util.Map interfaceDetails, or null if not present + */ + @Nullable Map getInterfaceDetails(); + + /** + * @return java.util.Map interfaceDetails, or an empty list if it is not present + */ + default @NonNull Map nonnullInterfaceDetails() { + return CodeHelpers.nonnull(getInterfaceDetails()); + } + + @Override + SupportedVnfInterfacesKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/SupportedVnfInterfacesBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/SupportedVnfInterfacesBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..482b6e4f6d9464a3866f551e25903de6fff4b1d4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/SupportedVnfInterfacesBuilder.java @@ -0,0 +1,315 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.supported.vnf.interfaces.InterfaceDetails; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.supported.vnf.interfaces.InterfaceDetailsKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link SupportedVnfInterfacesBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     SupportedVnfInterfacesBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new SupportedVnfInterfacesBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of SupportedVnfInterfacesBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see SupportedVnfInterfacesBuilder + * @see Builder + * + */ +public class SupportedVnfInterfacesBuilder implements Builder { + + private List _cpdId; + private Map _interfaceDetails; + private SupportedVnfInterfaces.Name _name; + private SupportedVnfInterfacesKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public SupportedVnfInterfacesBuilder() { + } + + public SupportedVnfInterfacesBuilder(SupportedVnfInterfaces base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._name = base.getName(); + this._cpdId = base.getCpdId(); + this._interfaceDetails = base.getInterfaceDetails(); + } + + + public SupportedVnfInterfacesKey key() { + return key; + } + + public List getCpdId() { + return _cpdId; + } + + public Map getInterfaceDetails() { + return _interfaceDetails; + } + + public SupportedVnfInterfaces.Name getName() { + return _name; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public SupportedVnfInterfacesBuilder withKey(final SupportedVnfInterfacesKey key) { + this.key = key; + return this; + } + public SupportedVnfInterfacesBuilder setCpdId(final List values) { + this._cpdId = values; + return this; + } + + public SupportedVnfInterfacesBuilder setInterfaceDetails(final Map values) { + this._interfaceDetails = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setInterfaceDetails(Map)} instead. + */ + @Deprecated(forRemoval = true) + public SupportedVnfInterfacesBuilder setInterfaceDetails(final List values) { + return setInterfaceDetails(CodeHelpers.compatMap(values)); + } + + public SupportedVnfInterfacesBuilder setName(final SupportedVnfInterfaces.Name value) { + this._name = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public SupportedVnfInterfacesBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public SupportedVnfInterfacesBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public SupportedVnfInterfacesBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private SupportedVnfInterfacesBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public SupportedVnfInterfaces build() { + return new SupportedVnfInterfacesImpl(this); + } + + private static final class SupportedVnfInterfacesImpl + extends AbstractAugmentable + implements SupportedVnfInterfaces { + + private final List _cpdId; + + private final Map _interfaceDetails; + private final SupportedVnfInterfaces.Name _name; + private final SupportedVnfInterfacesKey key; + + SupportedVnfInterfacesImpl(SupportedVnfInterfacesBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new SupportedVnfInterfacesKey(base.getName()); + } + this._name = key.getName(); + this._cpdId = base.getCpdId(); + this._interfaceDetails = CodeHelpers.emptyToNull(base.getInterfaceDetails()); + } + + @Override + public SupportedVnfInterfacesKey key() { + return key; + } + + @Override + public List getCpdId() { + return _cpdId; + } + + @Override + public Map getInterfaceDetails() { + return _interfaceDetails; + } + + @Override + public SupportedVnfInterfaces.Name getName() { + return _name; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cpdId); + result = prime * result + Objects.hashCode(_interfaceDetails); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!SupportedVnfInterfaces.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + SupportedVnfInterfaces other = (SupportedVnfInterfaces)obj; + if (!Objects.equals(_cpdId, other.getCpdId())) { + return false; + } + if (!Objects.equals(_interfaceDetails, other.getInterfaceDetails())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + SupportedVnfInterfacesImpl otherImpl = (SupportedVnfInterfacesImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("SupportedVnfInterfaces"); + CodeHelpers.appendValue(helper, "_cpdId", _cpdId); + CodeHelpers.appendValue(helper, "_interfaceDetails", _interfaceDetails); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/SupportedVnfInterfacesKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/SupportedVnfInterfacesKey.java new file mode 100644 index 0000000000000000000000000000000000000000..2b50ecb1562a1b8b5ba4dec3bc4ec687eb64fc39 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/SupportedVnfInterfacesKey.java @@ -0,0 +1,76 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.KeyDeserializer; +import com.google.common.base.MoreObjects; + +import java.io.IOException; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class SupportedVnfInterfacesKey extends KeyDeserializer + implements Identifier { + private static final long serialVersionUID = -2854504684379865139L; + private final SupportedVnfInterfaces.Name _name; + + + public SupportedVnfInterfacesKey() { + this._name = null; + } + + public SupportedVnfInterfacesKey(SupportedVnfInterfaces.Name _name) { + + this._name = _name; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public SupportedVnfInterfacesKey(SupportedVnfInterfacesKey source) { + this._name = source._name; + } + + + public SupportedVnfInterfaces.Name getName() { + return _name; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_name); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof SupportedVnfInterfacesKey)) { + return false; + } + final SupportedVnfInterfacesKey other = (SupportedVnfInterfacesKey) obj; + if (!Objects.equals(_name, other._name)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(SupportedVnfInterfacesKey.class); + CodeHelpers.appendValue(helper, "_name", _name); + return helper.toString(); + } + + @Override + public Object deserializeKey(String key, DeserializationContext ctxt) throws IOException { + // TODO Auto-generated method stub + return this.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VduProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VduProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..34ac51577bd6f46afcd34e8228a5813195ee8299 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VduProfile.java @@ -0,0 +1,125 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VduProfileBuilder.VduProfileImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.vdu.profile.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.vdu.profile.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint16; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * The Vduprofile describes additional instantiation data for a given VDU used in + * deployment flavour. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list vdu-profile {
+ *   key id;
+ *   min-elements 1;
+ *   leaf id {
+ *     type leafref {
+ *       path ../../../vdu/id;
+ *     }
+ *   }
+ *   leaf min-number-of-instances {
+ *     type uint16;
+ *     default 1;
+ *   }
+ *   leaf max-number-of-instances {
+ *     type uint16;
+ *     default 1;
+ *     must ". >= ../min-number-of-instances";
+ *   }
+ *   uses local-affinity-or-anti-affinity-rule;
+ *   list affinity-or-anti-affinity-group {
+ *     key id;
+ *     leaf id {
+ *       type leafref {
+ *         path ../../../affinity-or-anti-affinity-group/id;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/vdu-profile + * + *

To create instances of this class use {@link VduProfileBuilder}. + * @see VduProfileBuilder + * @see VduProfileKey + * + */ +@JsonDeserialize(as = VduProfileImpl.class) +@JsonIgnoreProperties(value = {"localAffinityOrAntiAffinityRule"}, ignoreUnknown = true) +public interface VduProfile + extends + ChildOf, + Augmentable, + LocalAffinityOrAntiAffinityRule, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vdu-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VduProfile.class; + } + + /** + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Minimum number of instances of the VNFC based on this VDU that is permitted to + * exist for this flavour. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 minNumberOfInstances, or null if not present + */ + @Nullable Uint16 getMinNumberOfInstances(); + + /** + * @return org.opendaylight.yangtools.yang.common.Uint16 maxNumberOfInstances, or null if not present + */ + @Nullable Uint16 getMaxNumberOfInstances(); + + /** + * Identifier(s) of the affinity or anti-affinity group(s) the VDU belongs to. + * + * + * + * @return java.util.Map affinityOrAntiAffinityGroup, or null if not present + */ + @Nullable Map getAffinityOrAntiAffinityGroup(); + + /** + * @return java.util.Map affinityOrAntiAffinityGroup, or an empty list if it is not present + */ + default @NonNull Map nonnullAffinityOrAntiAffinityGroup() { + return CodeHelpers.nonnull(getAffinityOrAntiAffinityGroup()); + } + + @Override + VduProfileKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VduProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VduProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..c108b16989ad60061073928ca05d754676272a7e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VduProfileBuilder.java @@ -0,0 +1,433 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Integer; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule.LocalAffinityOrAntiAffinityRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule.LocalAffinityOrAntiAffinityRuleBuilder; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule.LocalAffinityOrAntiAffinityRuleKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.vdu.profile.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.vdu.profile.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Class that builds {@link VduProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VduProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VduProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VduProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VduProfileBuilder + * @see Builder + * + */ +public class VduProfileBuilder implements Builder { + + private Map _affinityOrAntiAffinityGroup; + private String _id; + private Map _localAffinityOrAntiAffinityRule; + private Uint16 _maxNumberOfInstances; + private Uint16 _minNumberOfInstances; + private VduProfileKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VduProfileBuilder() { + } + public VduProfileBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule arg) { + this._localAffinityOrAntiAffinityRule = arg.getLocalAffinityOrAntiAffinityRule(); + } + + public VduProfileBuilder(VduProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._affinityOrAntiAffinityGroup = base.getAffinityOrAntiAffinityGroup(); + this._localAffinityOrAntiAffinityRule = base.getLocalAffinityOrAntiAffinityRule(); + this._maxNumberOfInstances = base.getMaxNumberOfInstances(); + this._minNumberOfInstances = base.getMinNumberOfInstances(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule) { + this._localAffinityOrAntiAffinityRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule)arg).getLocalAffinityOrAntiAffinityRule(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule]"); + } + + public VduProfileKey key() { + return key; + } + + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + public String getId() { + return _id; + } + + public Map getLocalAffinityOrAntiAffinityRule() { + return _localAffinityOrAntiAffinityRule; + } + + public Uint16 getMaxNumberOfInstances() { + return _maxNumberOfInstances; + } + + public Uint16 getMinNumberOfInstances() { + return _minNumberOfInstances; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VduProfileBuilder withKey(final VduProfileKey key) { + this.key = key; + return this; + } + public VduProfileBuilder setAffinityOrAntiAffinityGroup(final Map values) { + this._affinityOrAntiAffinityGroup = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setAffinityOrAntiAffinityGroup(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VduProfileBuilder setAffinityOrAntiAffinityGroup(final List values) { + return setAffinityOrAntiAffinityGroup(CodeHelpers.compatMap(values)); + } + + public VduProfileBuilder setId(final String value) { + this._id = value; + return this; + } + public VduProfileBuilder setLocalAffinityOrAntiAffinityRule(final Map values) { + this._localAffinityOrAntiAffinityRule = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setLocalAffinityOrAntiAffinityRule(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VduProfileBuilder setLocalAffinityOrAntiAffinityRule(final List values) { + return setLocalAffinityOrAntiAffinityRule(CodeHelpers.compatMap(values)); + } + + public VduProfileBuilder setMaxNumberOfInstances(final Uint16 value) { + this._maxNumberOfInstances = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setMaxNumberOfInstances(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public VduProfileBuilder setMaxNumberOfInstances(final Integer value) { + return setMaxNumberOfInstances(CodeHelpers.compatUint(value)); + } + + public VduProfileBuilder setMinNumberOfInstances(final Uint16 value) { + this._minNumberOfInstances = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setMinNumberOfInstances(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public VduProfileBuilder setMinNumberOfInstances(final Integer value) { + return setMinNumberOfInstances(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VduProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VduProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VduProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VduProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VduProfile build() { + return new VduProfileImpl(this); + } + + public static final class VduProfileImpl + extends AbstractAugmentable + implements VduProfile { + + private final Map _affinityOrAntiAffinityGroup; + private final String _id; + @JsonDeserialize(keyUsing = LocalAffinityOrAntiAffinityRuleKey.class) + private final Map _localAffinityOrAntiAffinityRule; + private final Uint16 _maxNumberOfInstances; + private final Uint16 _minNumberOfInstances; + private final VduProfileKey key; + + VduProfileImpl(VduProfileBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VduProfileKey(base.getId()); + } + this._id = key.getId(); + this._affinityOrAntiAffinityGroup = CodeHelpers.emptyToNull(base.getAffinityOrAntiAffinityGroup()); + this._localAffinityOrAntiAffinityRule = CodeHelpers.emptyToNull(base.getLocalAffinityOrAntiAffinityRule()); + this._maxNumberOfInstances = base.getMaxNumberOfInstances(); + this._minNumberOfInstances = base.getMinNumberOfInstances(); + } + + public VduProfileImpl() { + this( new VduProfileBuilder()); + } + + @Override + public VduProfileKey key() { + return key; + } + + @Override + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getLocalAffinityOrAntiAffinityRule() { + return _localAffinityOrAntiAffinityRule; + } + + @Override + public Uint16 getMaxNumberOfInstances() { + return _maxNumberOfInstances; + } + + @Override + public Uint16 getMinNumberOfInstances() { + return _minNumberOfInstances; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_affinityOrAntiAffinityGroup); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_localAffinityOrAntiAffinityRule); + result = prime * result + Objects.hashCode(_maxNumberOfInstances); + result = prime * result + Objects.hashCode(_minNumberOfInstances); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VduProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VduProfile other = (VduProfile)obj; + if (!Objects.equals(_affinityOrAntiAffinityGroup, other.getAffinityOrAntiAffinityGroup())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_localAffinityOrAntiAffinityRule, other.getLocalAffinityOrAntiAffinityRule())) { + return false; + } + if (!Objects.equals(_maxNumberOfInstances, other.getMaxNumberOfInstances())) { + return false; + } + if (!Objects.equals(_minNumberOfInstances, other.getMinNumberOfInstances())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VduProfileImpl otherImpl = (VduProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VduProfile"); + CodeHelpers.appendValue(helper, "_affinityOrAntiAffinityGroup", _affinityOrAntiAffinityGroup); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_localAffinityOrAntiAffinityRule", _localAffinityOrAntiAffinityRule); + CodeHelpers.appendValue(helper, "_maxNumberOfInstances", _maxNumberOfInstances); + CodeHelpers.appendValue(helper, "_minNumberOfInstances", _minNumberOfInstances); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VduProfileKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VduProfileKey.java new file mode 100644 index 0000000000000000000000000000000000000000..195989f2dfce3606ed6edb00ea4745f8fa13b63f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VduProfileKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VduProfileKey + implements Identifier { + private static final long serialVersionUID = -5202129500566804515L; + private final String _id; + + + public VduProfileKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VduProfileKey(VduProfileKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VduProfileKey)) { + return false; + } + final VduProfileKey other = (VduProfileKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VduProfileKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VirtualLinkProfile.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VirtualLinkProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..6de00da364242b97fc4b5c31bf6794890cba635b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VirtualLinkProfile.java @@ -0,0 +1,229 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import java.lang.Class; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VduBuilder.VduImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VirtualLinkProfileBuilder.VirtualLinkProfileImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.MaxBitRateRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.MinBitRateRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.VirtualLinkProtocolData; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * Defines the internal VLD along with additional data which is used in this DF. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list virtual-link-profile {
+ *   key "id flavour";
+ *   leaf id {
+ *     type leafref {
+ *       path ../../../int-virtual-link-desc/id;
+ *     }
+ *   }
+ *   leaf flavour {
+ *     type leafref {
+ *       path ../../../flavour/id;
+ *     }
+ *   }
+ *   uses local-affinity-or-anti-affinity-rule;
+ *   list affinity-or-anti-affinity-group {
+ *     key id;
+ *     leaf id {
+ *       type leafref {
+ *         path ../../../affinity-or-anti-affinity-group/id;
+ *       }
+ *     }
+ *   }
+ *   container max-bit-rate-requirements {
+ *     leaf root {
+ *       type uint32;
+ *     }
+ *     leaf leaf {
+ *       type uint32;
+ *     }
+ *   }
+ *   container min-bit-rate-requirements {
+ *     leaf root {
+ *       type uint32;
+ *     }
+ *     leaf leaf {
+ *       type uint32;
+ *     }
+ *   }
+ *   container virtual-link-protocol-data {
+ *     leaf associated-layer-protocol {
+ *       type identityref {
+ *         base layer-protocol;
+ *       }
+ *     }
+ *     container l2-protocol-data {
+ *       when "(../associated-layer-protocol = 'Ethernet') or (../associated-layer-protocol = 'MPLS') or (../associated-layer-protocol = 'ODU2') or (../associated-layer-protocol = 'Pseudo-Wire')";
+ *       leaf name {
+ *         type string;
+ *       }
+ *       leaf network-type {
+ *         type enumeration {
+ *           enum flat;
+ *           enum vlan;
+ *           enum vxlan;
+ *           enum gre;
+ *         }
+ *       }
+ *       leaf vlan-transparent {
+ *         type boolean;
+ *       }
+ *       leaf mtu {
+ *         type uint16;
+ *       }
+ *     }
+ *     container l3-protocol-data {
+ *       when "(../associated-layer-protocol = 'IPv4') or (../associated-layer-protocol = 'IPv6')";
+ *       leaf name {
+ *         type string;
+ *       }
+ *       leaf ip-version {
+ *         type enumeration {
+ *           enum ipv4;
+ *           enum ipv6;
+ *         }
+ *         default ipv4;
+ *       }
+ *       leaf cidr {
+ *         type string;
+ *       }
+ *       leaf-list ip-allocation-pools {
+ *         type string;
+ *       }
+ *       leaf gateway-ip {
+ *         type inet:ip-address;
+ *       }
+ *       leaf dhcp-enabled {
+ *         type boolean;
+ *         default true;
+ *       }
+ *       leaf ipv6-address-mode {
+ *         when "../ip-version = 'ipv6'";
+ *         type enumeration {
+ *           enum slaac;
+ *           enum dhcpv6-stateful;
+ *           enum dhcpv6-stateless;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/virtual-link-profile + * + *

To create instances of this class use {@link VirtualLinkProfileBuilder}. + * @see VirtualLinkProfileBuilder + * @see VirtualLinkProfileKey + * + */ +@JsonDeserialize(as = VirtualLinkProfileImpl.class) +@JsonIgnoreProperties(value = {"localAffinityOrAntiAffinityRule"}, ignoreUnknown = true) +public interface VirtualLinkProfile + extends + ChildOf, + Augmentable, + LocalAffinityOrAntiAffinityRule, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-link-profile"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VirtualLinkProfile.class; + } + + /** + * Uniquely identifies a Vnf VLD. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Identifies a flavour within the VnfVirtualLinkDesc. + * + * + * + * @return java.lang.Object flavour, or null if not present + */ + @Nullable Object getFlavour(); + + /** + * Identifier(s) of the affinity or anti-affinity group(s) the VnfVirtualLinkDesc + * belongs to. + * + * + * + * @return java.util.Map affinityOrAntiAffinityGroup, or null if not present + */ + @Nullable Map getAffinityOrAntiAffinityGroup(); + + /** + * @return java.util.Map affinityOrAntiAffinityGroup, or an empty list if it is not present + */ + default @NonNull Map nonnullAffinityOrAntiAffinityGroup() { + return CodeHelpers.nonnull(getAffinityOrAntiAffinityGroup()); + } + + /** + * Specifies the maximum bitrate requirements for a VL instantiated according to + * this profile. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.MaxBitRateRequirements maxBitRateRequirements, or null if not present + */ + @Nullable MaxBitRateRequirements getMaxBitRateRequirements(); + + /** + * Specifies the minimum bitrate requirements for a VL instantiated according to + * this profile. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.MinBitRateRequirements minBitRateRequirements, or null if not present + */ + @Nullable MinBitRateRequirements getMinBitRateRequirements(); + + /** + * Specifies the protocol data for a VL instantiated according to this profile. + * Cardinality 0 is used when no protocol data needs to be specified. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.VirtualLinkProtocolData virtualLinkProtocolData, or null if not present + */ + @Nullable VirtualLinkProtocolData getVirtualLinkProtocolData(); + + @Override + VirtualLinkProfileKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VirtualLinkProfileBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VirtualLinkProfileBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..1f08cbcddf2185404a25607e8aec8dbf0d787089 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VirtualLinkProfileBuilder.java @@ -0,0 +1,458 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule.LocalAffinityOrAntiAffinityRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.local.affinity.or.anti.affinity.rule.LocalAffinityOrAntiAffinityRuleKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.AffinityOrAntiAffinityGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.AffinityOrAntiAffinityGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.MaxBitRateRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.MinBitRateRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.VirtualLinkProtocolData; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualLinkProfileBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkProfileBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkProfileBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkProfileBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkProfileBuilder + * @see Builder + * + */ +public class VirtualLinkProfileBuilder implements Builder { + + private Map _affinityOrAntiAffinityGroup; + private Object _flavour; + private String _id; + private Map _localAffinityOrAntiAffinityRule; + private MaxBitRateRequirements _maxBitRateRequirements; + private MinBitRateRequirements _minBitRateRequirements; + private VirtualLinkProtocolData _virtualLinkProtocolData; + private VirtualLinkProfileKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualLinkProfileBuilder() { + } + public VirtualLinkProfileBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule arg) { + this._localAffinityOrAntiAffinityRule = arg.getLocalAffinityOrAntiAffinityRule(); + } + + public VirtualLinkProfileBuilder(VirtualLinkProfile base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._flavour = base.getFlavour(); + this._id = base.getId(); + this._affinityOrAntiAffinityGroup = base.getAffinityOrAntiAffinityGroup(); + this._localAffinityOrAntiAffinityRule = base.getLocalAffinityOrAntiAffinityRule(); + this._maxBitRateRequirements = base.getMaxBitRateRequirements(); + this._minBitRateRequirements = base.getMinBitRateRequirements(); + this._virtualLinkProtocolData = base.getVirtualLinkProtocolData(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule) { + this._localAffinityOrAntiAffinityRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule)arg).getLocalAffinityOrAntiAffinityRule(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LocalAffinityOrAntiAffinityRule]"); + } + + public VirtualLinkProfileKey key() { + return key; + } + + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + public Object getFlavour() { + return _flavour; + } + + public String getId() { + return _id; + } + + public Map getLocalAffinityOrAntiAffinityRule() { + return _localAffinityOrAntiAffinityRule; + } + + public MaxBitRateRequirements getMaxBitRateRequirements() { + return _maxBitRateRequirements; + } + + public MinBitRateRequirements getMinBitRateRequirements() { + return _minBitRateRequirements; + } + + public VirtualLinkProtocolData getVirtualLinkProtocolData() { + return _virtualLinkProtocolData; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VirtualLinkProfileBuilder withKey(final VirtualLinkProfileKey key) { + this.key = key; + return this; + } + public VirtualLinkProfileBuilder setAffinityOrAntiAffinityGroup(final Map values) { + this._affinityOrAntiAffinityGroup = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setAffinityOrAntiAffinityGroup(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkProfileBuilder setAffinityOrAntiAffinityGroup(final List values) { + return setAffinityOrAntiAffinityGroup(CodeHelpers.compatMap(values)); + } + + public VirtualLinkProfileBuilder setFlavour(final Object value) { + this._flavour = value; + return this; + } + + public VirtualLinkProfileBuilder setId(final String value) { + this._id = value; + return this; + } + public VirtualLinkProfileBuilder setLocalAffinityOrAntiAffinityRule(final Map values) { + this._localAffinityOrAntiAffinityRule = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setLocalAffinityOrAntiAffinityRule(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkProfileBuilder setLocalAffinityOrAntiAffinityRule(final List values) { + return setLocalAffinityOrAntiAffinityRule(CodeHelpers.compatMap(values)); + } + + public VirtualLinkProfileBuilder setMaxBitRateRequirements(final MaxBitRateRequirements value) { + this._maxBitRateRequirements = value; + return this; + } + + public VirtualLinkProfileBuilder setMinBitRateRequirements(final MinBitRateRequirements value) { + this._minBitRateRequirements = value; + return this; + } + + public VirtualLinkProfileBuilder setVirtualLinkProtocolData(final VirtualLinkProtocolData value) { + this._virtualLinkProtocolData = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualLinkProfileBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkProfileBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualLinkProfileBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualLinkProfileBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualLinkProfile build() { + return new VirtualLinkProfileImpl(this); + } + + public static final class VirtualLinkProfileImpl + extends AbstractAugmentable + implements VirtualLinkProfile { + + private final Map _affinityOrAntiAffinityGroup; + private Object _flavour; + private final String _id; + private final Map _localAffinityOrAntiAffinityRule; + private final MaxBitRateRequirements _maxBitRateRequirements; + private final MinBitRateRequirements _minBitRateRequirements; + private final VirtualLinkProtocolData _virtualLinkProtocolData; + private VirtualLinkProfileKey key; + + VirtualLinkProfileImpl(VirtualLinkProfileBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VirtualLinkProfileKey(base.getFlavour(), base.getId()); + } + this._flavour = key.getFlavour(); + this._id = key.getId(); + this._affinityOrAntiAffinityGroup = CodeHelpers.emptyToNull(base.getAffinityOrAntiAffinityGroup()); + this._localAffinityOrAntiAffinityRule = CodeHelpers.emptyToNull(base.getLocalAffinityOrAntiAffinityRule()); + this._maxBitRateRequirements = base.getMaxBitRateRequirements(); + this._minBitRateRequirements = base.getMinBitRateRequirements(); + this._virtualLinkProtocolData = base.getVirtualLinkProtocolData(); + } + + public VirtualLinkProfileImpl() { + this( new VirtualLinkProfileBuilder()); + } + + @Override + public VirtualLinkProfileKey key() { + if ( ( key != null) && ( key.getId() == null) && ( _id != null) ) { + if(_flavour == null) + _flavour=""; + key = new VirtualLinkProfileKey(_flavour, _id); + } + return key; + } + + @Override + public Map getAffinityOrAntiAffinityGroup() { + return _affinityOrAntiAffinityGroup; + } + + @Override + public Object getFlavour() { + return _flavour; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getLocalAffinityOrAntiAffinityRule() { + return _localAffinityOrAntiAffinityRule; + } + + @Override + public MaxBitRateRequirements getMaxBitRateRequirements() { + return _maxBitRateRequirements; + } + + @Override + public MinBitRateRequirements getMinBitRateRequirements() { + return _minBitRateRequirements; + } + + @Override + public VirtualLinkProtocolData getVirtualLinkProtocolData() { + return _virtualLinkProtocolData; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_affinityOrAntiAffinityGroup); + result = prime * result + Objects.hashCode(_flavour); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_localAffinityOrAntiAffinityRule); + result = prime * result + Objects.hashCode(_maxBitRateRequirements); + result = prime * result + Objects.hashCode(_minBitRateRequirements); + result = prime * result + Objects.hashCode(_virtualLinkProtocolData); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkProfile.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkProfile other = (VirtualLinkProfile)obj; + if (!Objects.equals(_affinityOrAntiAffinityGroup, other.getAffinityOrAntiAffinityGroup())) { + return false; + } + if (!Objects.equals(_flavour, other.getFlavour())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_localAffinityOrAntiAffinityRule, other.getLocalAffinityOrAntiAffinityRule())) { + return false; + } + if (!Objects.equals(_maxBitRateRequirements, other.getMaxBitRateRequirements())) { + return false; + } + if (!Objects.equals(_minBitRateRequirements, other.getMinBitRateRequirements())) { + return false; + } + if (!Objects.equals(_virtualLinkProtocolData, other.getVirtualLinkProtocolData())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualLinkProfileImpl otherImpl = (VirtualLinkProfileImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkProfile"); + CodeHelpers.appendValue(helper, "_affinityOrAntiAffinityGroup", _affinityOrAntiAffinityGroup); + CodeHelpers.appendValue(helper, "_flavour", _flavour); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_localAffinityOrAntiAffinityRule", _localAffinityOrAntiAffinityRule); + CodeHelpers.appendValue(helper, "_maxBitRateRequirements", _maxBitRateRequirements); + CodeHelpers.appendValue(helper, "_minBitRateRequirements", _minBitRateRequirements); + CodeHelpers.appendValue(helper, "_virtualLinkProtocolData", _virtualLinkProtocolData); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VirtualLinkProfileKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VirtualLinkProfileKey.java new file mode 100644 index 0000000000000000000000000000000000000000..292171ac8ad632048efdeeb69291caef62ca08da --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/VirtualLinkProfileKey.java @@ -0,0 +1,95 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.KeyDeserializer; +import com.google.common.base.MoreObjects; + +import java.io.IOException; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; + +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VirtualLinkProfileKey extends KeyDeserializer + implements Identifier { + private static final long serialVersionUID = 1298066409440857060L; + private final String _id; + private final Object _flavour; + + + public VirtualLinkProfileKey() { + // This might be also null, or not id/flavor not final. + this._id = ""; + this._flavour = ""; + } + + public VirtualLinkProfileKey(Object _flavour, String _id) { + + this._id = _id; + this._flavour = _flavour; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VirtualLinkProfileKey(VirtualLinkProfileKey source) { + this._id = source._id; + this._flavour = source._flavour; + } + + + public String getId() { + return _id; + } + + public Object getFlavour() { + return _flavour; + } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_flavour); + return result; + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VirtualLinkProfileKey)) { + return false; + } + final VirtualLinkProfileKey other = (VirtualLinkProfileKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + if (!Objects.equals(_flavour, other._flavour)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VirtualLinkProfileKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_flavour", _flavour); + return helper.toString(); + } + + @Override + public Object deserializeKey(String key, DeserializationContext ctxt) throws IOException { + // TODO Auto-generated method stub + return this.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/ScalingInfo.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/ScalingInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..730fdedf8fafbfa1f87a1f9288c24b5cea7727f7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/ScalingInfo.java @@ -0,0 +1,80 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.InstantiationLevel; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * The InstantiationLevel information element describes a given level of resources + * to be instantiated within a DF in term of the number of VNFC instances to be + * created from each VDU. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list scaling-info {
+ *   key scaling-aspect-id;
+ *   leaf scaling-aspect-id {
+ *     type leafref {
+ *       path ../../../scaling-aspect/id;
+ *     }
+ *   }
+ *   leaf scale-level {
+ *     type uint32;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/instantiation-level/scaling-info + * + *

To create instances of this class use {@link ScalingInfoBuilder}. + * @see ScalingInfoBuilder + * @see ScalingInfoKey + * + */ +public interface ScalingInfo + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("scaling-info"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level.ScalingInfo.class; + } + + /** + * Identifier of the scaling aspect. + * + * + * + * @return java.lang.String scalingAspectId, or null if not present + */ + @Nullable String getScalingAspectId(); + + /** + * The scale level, greater than or equal to 0. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 scaleLevel, or null if not present + */ + @Nullable Uint32 getScaleLevel(); + + @Override + ScalingInfoKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/ScalingInfoBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/ScalingInfoBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..88469c084d23f8c2ae8a57f64a097d8af4efa9cc --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/ScalingInfoBuilder.java @@ -0,0 +1,285 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link ScalingInfoBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ScalingInfoBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ScalingInfoBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ScalingInfoBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ScalingInfoBuilder + * @see Builder + * + */ +public class ScalingInfoBuilder implements Builder { + + private Uint32 _scaleLevel; + private String _scalingAspectId; + private ScalingInfoKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ScalingInfoBuilder() { + } + + public ScalingInfoBuilder(ScalingInfo base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._scalingAspectId = base.getScalingAspectId(); + this._scaleLevel = base.getScaleLevel(); + } + + + public ScalingInfoKey key() { + return key; + } + + public Uint32 getScaleLevel() { + return _scaleLevel; + } + + public String getScalingAspectId() { + return _scalingAspectId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ScalingInfoBuilder withKey(final ScalingInfoKey key) { + this.key = key; + return this; + } + + public ScalingInfoBuilder setScaleLevel(final Uint32 value) { + this._scaleLevel = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setScaleLevel(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public ScalingInfoBuilder setScaleLevel(final Long value) { + return setScaleLevel(CodeHelpers.compatUint(value)); + } + + public ScalingInfoBuilder setScalingAspectId(final String value) { + this._scalingAspectId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ScalingInfoBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ScalingInfoBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ScalingInfoBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ScalingInfoBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ScalingInfo build() { + return new ScalingInfoImpl(this); + } + + private static final class ScalingInfoImpl + extends AbstractAugmentable + implements ScalingInfo { + + private final Uint32 _scaleLevel; + private final String _scalingAspectId; + private final ScalingInfoKey key; + + ScalingInfoImpl(ScalingInfoBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ScalingInfoKey(base.getScalingAspectId()); + } + this._scalingAspectId = key.getScalingAspectId(); + this._scaleLevel = base.getScaleLevel(); + } + + @Override + public ScalingInfoKey key() { + return key; + } + + @Override + public Uint32 getScaleLevel() { + return _scaleLevel; + } + + @Override + public String getScalingAspectId() { + return _scalingAspectId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_scaleLevel); + result = prime * result + Objects.hashCode(_scalingAspectId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ScalingInfo.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ScalingInfo other = (ScalingInfo)obj; + if (!Objects.equals(_scaleLevel, other.getScaleLevel())) { + return false; + } + if (!Objects.equals(_scalingAspectId, other.getScalingAspectId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ScalingInfoImpl otherImpl = (ScalingInfoImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ScalingInfo"); + CodeHelpers.appendValue(helper, "_scaleLevel", _scaleLevel); + CodeHelpers.appendValue(helper, "_scalingAspectId", _scalingAspectId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/ScalingInfoKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/ScalingInfoKey.java new file mode 100644 index 0000000000000000000000000000000000000000..f0ef9c4e9407b9dc0356e6b9e5318eb3c9943278 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/ScalingInfoKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ScalingInfoKey + implements Identifier { + private static final long serialVersionUID = -1279594473036189260L; + private final String _scalingAspectId; + + + public ScalingInfoKey(String _scalingAspectId) { + + this._scalingAspectId = _scalingAspectId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ScalingInfoKey(ScalingInfoKey source) { + this._scalingAspectId = source._scalingAspectId; + } + + + public String getScalingAspectId() { + return _scalingAspectId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_scalingAspectId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ScalingInfoKey)) { + return false; + } + final ScalingInfoKey other = (ScalingInfoKey) obj; + if (!Objects.equals(_scalingAspectId, other._scalingAspectId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ScalingInfoKey.class); + CodeHelpers.appendValue(helper, "_scalingAspectId", _scalingAspectId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/VduLevel.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/VduLevel.java new file mode 100644 index 0000000000000000000000000000000000000000..a1f3c4bdd63db47e42e15deebb82783fc49995c5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/VduLevel.java @@ -0,0 +1,82 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.InstantiationLevel; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Sets the number of instances for the VDU in this instantiation level. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list vdu-level {
+ *   key vdu-id;
+ *   min-elements 1;
+ *   leaf vdu-id {
+ *     type leafref {
+ *       path ../../../../vdu/id;
+ *     }
+ *   }
+ *   leaf number-of-instances {
+ *     type uint16;
+ *     must ". <= ../../../../df/vdu-profile[id=current()/../vdu-id]/max-number-of-instances";
+ *     must ". >= ../../../../df/vdu-profile[id=current()/../vdu-id]/min-number-of-instances";
+ *     default 1;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/instantiation-level/vdu-level + * + *

To create instances of this class use {@link VduLevelBuilder}. + * @see VduLevelBuilder + * @see VduLevelKey + * + */ +public interface VduLevel + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vdu-level"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level.VduLevel.class; + } + + /** + * Uniquely identifies a VDU. + * + * + * + * @return java.lang.String vduId, or null if not present + */ + @Nullable String getVduId(); + + /** + * Number of instances of VNFC based on this VDU to deploy for this level. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 numberOfInstances, or null if not present + */ + @Nullable Uint16 getNumberOfInstances(); + + @Override + VduLevelKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/VduLevelBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/VduLevelBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..95e331fae7ebb2393b600082087bd1247b30ce26 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/VduLevelBuilder.java @@ -0,0 +1,285 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Integer; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Class that builds {@link VduLevelBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VduLevelBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VduLevelBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VduLevelBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VduLevelBuilder + * @see Builder + * + */ +public class VduLevelBuilder implements Builder { + + private Uint16 _numberOfInstances; + private String _vduId; + private VduLevelKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VduLevelBuilder() { + } + + public VduLevelBuilder(VduLevel base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._vduId = base.getVduId(); + this._numberOfInstances = base.getNumberOfInstances(); + } + + + public VduLevelKey key() { + return key; + } + + public Uint16 getNumberOfInstances() { + return _numberOfInstances; + } + + public String getVduId() { + return _vduId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VduLevelBuilder withKey(final VduLevelKey key) { + this.key = key; + return this; + } + + public VduLevelBuilder setNumberOfInstances(final Uint16 value) { + this._numberOfInstances = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setNumberOfInstances(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public VduLevelBuilder setNumberOfInstances(final Integer value) { + return setNumberOfInstances(CodeHelpers.compatUint(value)); + } + + public VduLevelBuilder setVduId(final String value) { + this._vduId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VduLevelBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VduLevelBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VduLevelBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VduLevelBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VduLevel build() { + return new VduLevelImpl(this); + } + + private static final class VduLevelImpl + extends AbstractAugmentable + implements VduLevel { + + private final Uint16 _numberOfInstances; + private final String _vduId; + private final VduLevelKey key; + + VduLevelImpl(VduLevelBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VduLevelKey(base.getVduId()); + } + this._vduId = key.getVduId(); + this._numberOfInstances = base.getNumberOfInstances(); + } + + @Override + public VduLevelKey key() { + return key; + } + + @Override + public Uint16 getNumberOfInstances() { + return _numberOfInstances; + } + + @Override + public String getVduId() { + return _vduId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_numberOfInstances); + result = prime * result + Objects.hashCode(_vduId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VduLevel.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VduLevel other = (VduLevel)obj; + if (!Objects.equals(_numberOfInstances, other.getNumberOfInstances())) { + return false; + } + if (!Objects.equals(_vduId, other.getVduId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VduLevelImpl otherImpl = (VduLevelImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VduLevel"); + CodeHelpers.appendValue(helper, "_numberOfInstances", _numberOfInstances); + CodeHelpers.appendValue(helper, "_vduId", _vduId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/VduLevelKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/VduLevelKey.java new file mode 100644 index 0000000000000000000000000000000000000000..1727daf4d979afeebd54e4cd5a2d6d76037ea564 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/instantiation/level/VduLevelKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.instantiation.level; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VduLevelKey + implements Identifier { + private static final long serialVersionUID = 7472299403991418175L; + private final String _vduId; + + + public VduLevelKey(String _vduId) { + + this._vduId = _vduId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VduLevelKey(VduLevelKey source) { + this._vduId = source._vduId; + } + + + public String getVduId() { + return _vduId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_vduId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VduLevelKey)) { + return false; + } + final VduLevelKey other = (VduLevelKey) obj; + if (!Objects.equals(_vduId, other._vduId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VduLevelKey.class); + CodeHelpers.appendValue(helper, "_vduId", _vduId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeExtVnfConnectivityOpConfig.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeExtVnfConnectivityOpConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..80049e89a3bc1cf20e8e31b5f9fc2b9d8f9491df --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeExtVnfConnectivityOpConfig.java @@ -0,0 +1,73 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.ext.vnf.connectivity.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.ext.vnf.connectivity.op.config.ParameterKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Configuration parameters for the ChangeExtVnfConnectivity operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container change-ext-vnf-connectivity-op-config {
+ *   list parameter {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/change-ext-vnf-connectivity-op-config + * + *

To create instances of this class use {@link ChangeExtVnfConnectivityOpConfigBuilder}. + * @see ChangeExtVnfConnectivityOpConfigBuilder + * + */ +public interface ChangeExtVnfConnectivityOpConfig + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("change-ext-vnf-connectivity-op-config"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ChangeExtVnfConnectivityOpConfig.class; + } + + /** + * Array of KVP requirements for VNF-specific parameters to be passed when invoking + * the ChangeExtVnfConnectivity operation. + * + * + * + * @return java.util.Map parameter, or null if not present + */ + @Nullable Map getParameter(); + + /** + * @return java.util.Map parameter, or an empty list if it is not present + */ + default @NonNull Map nonnullParameter() { + return CodeHelpers.nonnull(getParameter()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeExtVnfConnectivityOpConfigBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeExtVnfConnectivityOpConfigBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..5c4969abaf5b9b44fbf6b2a1dd2047d579c29c0d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeExtVnfConnectivityOpConfigBuilder.java @@ -0,0 +1,247 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.ext.vnf.connectivity.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.ext.vnf.connectivity.op.config.ParameterKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ChangeExtVnfConnectivityOpConfigBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ChangeExtVnfConnectivityOpConfigBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ChangeExtVnfConnectivityOpConfigBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ChangeExtVnfConnectivityOpConfigBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ChangeExtVnfConnectivityOpConfigBuilder + * @see Builder + * + */ +public class ChangeExtVnfConnectivityOpConfigBuilder implements Builder { + + private Map _parameter; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ChangeExtVnfConnectivityOpConfigBuilder() { + } + + public ChangeExtVnfConnectivityOpConfigBuilder(ChangeExtVnfConnectivityOpConfig base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._parameter = base.getParameter(); + } + + + public Map getParameter() { + return _parameter; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ChangeExtVnfConnectivityOpConfigBuilder setParameter(final Map values) { + this._parameter = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setParameter(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ChangeExtVnfConnectivityOpConfigBuilder setParameter(final List values) { + return setParameter(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ChangeExtVnfConnectivityOpConfigBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ChangeExtVnfConnectivityOpConfigBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ChangeExtVnfConnectivityOpConfigBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ChangeExtVnfConnectivityOpConfigBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ChangeExtVnfConnectivityOpConfig build() { + return new ChangeExtVnfConnectivityOpConfigImpl(this); + } + + private static final class ChangeExtVnfConnectivityOpConfigImpl + extends AbstractAugmentable + implements ChangeExtVnfConnectivityOpConfig { + + private final Map _parameter; + + ChangeExtVnfConnectivityOpConfigImpl(ChangeExtVnfConnectivityOpConfigBuilder base) { + super(base.augmentation); + this._parameter = CodeHelpers.emptyToNull(base.getParameter()); + } + + @Override + public Map getParameter() { + return _parameter; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_parameter); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ChangeExtVnfConnectivityOpConfig.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ChangeExtVnfConnectivityOpConfig other = (ChangeExtVnfConnectivityOpConfig)obj; + if (!Objects.equals(_parameter, other.getParameter())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ChangeExtVnfConnectivityOpConfigImpl otherImpl = (ChangeExtVnfConnectivityOpConfigImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ChangeExtVnfConnectivityOpConfig"); + CodeHelpers.appendValue(helper, "_parameter", _parameter); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeVnfFlavourOpConfig.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeVnfFlavourOpConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..b506cf5dec4ddfe3536169d18b490a70505da631 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeVnfFlavourOpConfig.java @@ -0,0 +1,73 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.vnf.flavour.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.vnf.flavour.op.config.ParameterKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Configuration parameters for the ChangeVnfFlavour operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container change-vnf-flavour-op-config {
+ *   list parameter {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/change-vnf-flavour-op-config + * + *

To create instances of this class use {@link ChangeVnfFlavourOpConfigBuilder}. + * @see ChangeVnfFlavourOpConfigBuilder + * + */ +public interface ChangeVnfFlavourOpConfig + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("change-vnf-flavour-op-config"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ChangeVnfFlavourOpConfig.class; + } + + /** + * Array of KVP requirements for VNF-specific parameters to be passed when invoking + * the OperateVnf operation. + * + * + * + * @return java.util.Map parameter, or null if not present + */ + @Nullable Map getParameter(); + + /** + * @return java.util.Map parameter, or an empty list if it is not present + */ + default @NonNull Map nonnullParameter() { + return CodeHelpers.nonnull(getParameter()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeVnfFlavourOpConfigBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeVnfFlavourOpConfigBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..09a4cf2ec216f3489714de01eda6796712c8e47d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ChangeVnfFlavourOpConfigBuilder.java @@ -0,0 +1,247 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.vnf.flavour.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.vnf.flavour.op.config.ParameterKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ChangeVnfFlavourOpConfigBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ChangeVnfFlavourOpConfigBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ChangeVnfFlavourOpConfigBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ChangeVnfFlavourOpConfigBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ChangeVnfFlavourOpConfigBuilder + * @see Builder + * + */ +public class ChangeVnfFlavourOpConfigBuilder implements Builder { + + private Map _parameter; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ChangeVnfFlavourOpConfigBuilder() { + } + + public ChangeVnfFlavourOpConfigBuilder(ChangeVnfFlavourOpConfig base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._parameter = base.getParameter(); + } + + + public Map getParameter() { + return _parameter; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ChangeVnfFlavourOpConfigBuilder setParameter(final Map values) { + this._parameter = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setParameter(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ChangeVnfFlavourOpConfigBuilder setParameter(final List values) { + return setParameter(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ChangeVnfFlavourOpConfigBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ChangeVnfFlavourOpConfigBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ChangeVnfFlavourOpConfigBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ChangeVnfFlavourOpConfigBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ChangeVnfFlavourOpConfig build() { + return new ChangeVnfFlavourOpConfigImpl(this); + } + + private static final class ChangeVnfFlavourOpConfigImpl + extends AbstractAugmentable + implements ChangeVnfFlavourOpConfig { + + private final Map _parameter; + + ChangeVnfFlavourOpConfigImpl(ChangeVnfFlavourOpConfigBuilder base) { + super(base.augmentation); + this._parameter = CodeHelpers.emptyToNull(base.getParameter()); + } + + @Override + public Map getParameter() { + return _parameter; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_parameter); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ChangeVnfFlavourOpConfig.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ChangeVnfFlavourOpConfig other = (ChangeVnfFlavourOpConfig)obj; + if (!Objects.equals(_parameter, other.getParameter())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ChangeVnfFlavourOpConfigImpl otherImpl = (ChangeVnfFlavourOpConfigImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ChangeVnfFlavourOpConfig"); + CodeHelpers.appendValue(helper, "_parameter", _parameter); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/HealVnfOpConfig.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/HealVnfOpConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..dfe422c4dd1d1bae46ee9fff65cc7a12e398407a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/HealVnfOpConfig.java @@ -0,0 +1,88 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.heal.vnf.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.heal.vnf.op.config.ParameterKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This information element defines attributes that affect the invocation of the + * HealVnf operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container heal-vnf-op-config {
+ *   list parameter {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ *   leaf-list cause {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/heal-vnf-op-config + * + *

To create instances of this class use {@link HealVnfOpConfigBuilder}. + * @see HealVnfOpConfigBuilder + * + */ +public interface HealVnfOpConfig + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("heal-vnf-op-config"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.HealVnfOpConfig.class; + } + + /** + * Array of KVP requirements for VNF-specific parameters to be passed when invoking + * the HealVnf operation. + * + * + * + * @return java.util.Map parameter, or null if not present + */ + @Nullable Map getParameter(); + + /** + * @return java.util.Map parameter, or an empty list if it is not present + */ + default @NonNull Map nonnullParameter() { + return CodeHelpers.nonnull(getParameter()); + } + + /** + * Supported 'cause' parameter values. + * + * + * + * @return java.util.List cause, or null if not present + */ + @Nullable List getCause(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/HealVnfOpConfigBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/HealVnfOpConfigBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..ddfb8f954dce728aa34682a11b592be1fe3a2dc7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/HealVnfOpConfigBuilder.java @@ -0,0 +1,270 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.heal.vnf.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.heal.vnf.op.config.ParameterKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link HealVnfOpConfigBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     HealVnfOpConfigBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new HealVnfOpConfigBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of HealVnfOpConfigBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see HealVnfOpConfigBuilder + * @see Builder + * + */ +public class HealVnfOpConfigBuilder implements Builder { + + private List _cause; + private Map _parameter; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public HealVnfOpConfigBuilder() { + } + + public HealVnfOpConfigBuilder(HealVnfOpConfig base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._cause = base.getCause(); + this._parameter = base.getParameter(); + } + + + public List getCause() { + return _cause; + } + + public Map getParameter() { + return _parameter; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public HealVnfOpConfigBuilder setCause(final List values) { + this._cause = values; + return this; + } + + public HealVnfOpConfigBuilder setParameter(final Map values) { + this._parameter = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setParameter(Map)} instead. + */ + @Deprecated(forRemoval = true) + public HealVnfOpConfigBuilder setParameter(final List values) { + return setParameter(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public HealVnfOpConfigBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public HealVnfOpConfigBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public HealVnfOpConfigBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private HealVnfOpConfigBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public HealVnfOpConfig build() { + return new HealVnfOpConfigImpl(this); + } + + private static final class HealVnfOpConfigImpl + extends AbstractAugmentable + implements HealVnfOpConfig { + + private final List _cause; + private final Map _parameter; + + HealVnfOpConfigImpl(HealVnfOpConfigBuilder base) { + super(base.augmentation); + this._cause = base.getCause(); + this._parameter = CodeHelpers.emptyToNull(base.getParameter()); + } + + @Override + public List getCause() { + return _cause; + } + + @Override + public Map getParameter() { + return _parameter; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cause); + result = prime * result + Objects.hashCode(_parameter); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!HealVnfOpConfig.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + HealVnfOpConfig other = (HealVnfOpConfig)obj; + if (!Objects.equals(_cause, other.getCause())) { + return false; + } + if (!Objects.equals(_parameter, other.getParameter())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + HealVnfOpConfigImpl otherImpl = (HealVnfOpConfigImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("HealVnfOpConfig"); + CodeHelpers.appendValue(helper, "_cause", _cause); + CodeHelpers.appendValue(helper, "_parameter", _parameter); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/InstantiateVnfOpConfig.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/InstantiateVnfOpConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..d1c1f61c03ae9272c0d6f535c456256291a2a3f6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/InstantiateVnfOpConfig.java @@ -0,0 +1,73 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.instantiate.vnf.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.instantiate.vnf.op.config.ParameterKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Configuration parameters for the InstantiateVnf operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container instantiate-vnf-op-config {
+ *   list parameter {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/instantiate-vnf-op-config + * + *

To create instances of this class use {@link InstantiateVnfOpConfigBuilder}. + * @see InstantiateVnfOpConfigBuilder + * + */ +public interface InstantiateVnfOpConfig + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("instantiate-vnf-op-config"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.InstantiateVnfOpConfig.class; + } + + /** + * Array of KVP requirements for VNF-specific parameters to be passed when invoking + * the InstantiateVnf operation. + * + * + * + * @return java.util.Map parameter, or null if not present + */ + @Nullable Map getParameter(); + + /** + * @return java.util.Map parameter, or an empty list if it is not present + */ + default @NonNull Map nonnullParameter() { + return CodeHelpers.nonnull(getParameter()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/InstantiateVnfOpConfigBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/InstantiateVnfOpConfigBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..e081bd8c48b4160bab4bc85d499e4d7bc53dc2c9 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/InstantiateVnfOpConfigBuilder.java @@ -0,0 +1,247 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.instantiate.vnf.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.instantiate.vnf.op.config.ParameterKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link InstantiateVnfOpConfigBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     InstantiateVnfOpConfigBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new InstantiateVnfOpConfigBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of InstantiateVnfOpConfigBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see InstantiateVnfOpConfigBuilder + * @see Builder + * + */ +public class InstantiateVnfOpConfigBuilder implements Builder { + + private Map _parameter; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public InstantiateVnfOpConfigBuilder() { + } + + public InstantiateVnfOpConfigBuilder(InstantiateVnfOpConfig base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._parameter = base.getParameter(); + } + + + public Map getParameter() { + return _parameter; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public InstantiateVnfOpConfigBuilder setParameter(final Map values) { + this._parameter = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setParameter(Map)} instead. + */ + @Deprecated(forRemoval = true) + public InstantiateVnfOpConfigBuilder setParameter(final List values) { + return setParameter(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public InstantiateVnfOpConfigBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public InstantiateVnfOpConfigBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public InstantiateVnfOpConfigBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private InstantiateVnfOpConfigBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public InstantiateVnfOpConfig build() { + return new InstantiateVnfOpConfigImpl(this); + } + + private static final class InstantiateVnfOpConfigImpl + extends AbstractAugmentable + implements InstantiateVnfOpConfig { + + private final Map _parameter; + + InstantiateVnfOpConfigImpl(InstantiateVnfOpConfigBuilder base) { + super(base.augmentation); + this._parameter = CodeHelpers.emptyToNull(base.getParameter()); + } + + @Override + public Map getParameter() { + return _parameter; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_parameter); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!InstantiateVnfOpConfig.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + InstantiateVnfOpConfig other = (InstantiateVnfOpConfig)obj; + if (!Objects.equals(_parameter, other.getParameter())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + InstantiateVnfOpConfigImpl otherImpl = (InstantiateVnfOpConfigImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("InstantiateVnfOpConfig"); + CodeHelpers.appendValue(helper, "_parameter", _parameter); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/OperateVnfOpConfig.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/OperateVnfOpConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..2f91bdda3726d698629b28b9e64f16dcac0dbb52 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/OperateVnfOpConfig.java @@ -0,0 +1,104 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.operate.vnf.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.operate.vnf.op.config.ParameterKey; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This information element defines attributes that affect the invocation of the + * OperateVnf operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container operate-vnf-op-config {
+ *   leaf min-graceful-stop-timeout {
+ *     type yang:timeticks;
+ *     default 1;
+ *   }
+ *   leaf max-recommended-graceful-stop-timeout {
+ *     type yang:timeticks;
+ *   }
+ *   list parameter {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/operate-vnf-op-config + * + *

To create instances of this class use {@link OperateVnfOpConfigBuilder}. + * @see OperateVnfOpConfigBuilder + * + */ +public interface OperateVnfOpConfig + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("operate-vnf-op-config"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.OperateVnfOpConfig.class; + } + + /** + * Minimum timeout value for graceful stop of a VNF instance. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks minGracefulStopTimeout, or null if not present + */ + @Nullable Timeticks getMinGracefulStopTimeout(); + + /** + * Maximum recommended timeout value that can be needed to gracefully stop a VNF + * instance of a particular type under certain conditions, such as maximum load + * condition. This is provided by VNF provider as information for the operator + * facilitating the selection of optimal timeout value. This value is not used as + * constraint. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks maxRecommendedGracefulStopTimeout, or null if not present + */ + @Nullable Timeticks getMaxRecommendedGracefulStopTimeout(); + + /** + * Array of KVP requirements for VNF-specific parameters to be passed when invoking + * the OperateVnf operation. + * + * + * + * @return java.util.Map parameter, or null if not present + */ + @Nullable Map getParameter(); + + /** + * @return java.util.Map parameter, or an empty list if it is not present + */ + default @NonNull Map nonnullParameter() { + return CodeHelpers.nonnull(getParameter()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/OperateVnfOpConfigBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/OperateVnfOpConfigBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..53792e6a8d7e9cec41b6afc151ff93d1ede539b2 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/OperateVnfOpConfigBuilder.java @@ -0,0 +1,294 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.operate.vnf.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.operate.vnf.op.config.ParameterKey; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link OperateVnfOpConfigBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     OperateVnfOpConfigBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new OperateVnfOpConfigBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of OperateVnfOpConfigBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see OperateVnfOpConfigBuilder + * @see Builder + * + */ +public class OperateVnfOpConfigBuilder implements Builder { + + private Timeticks _maxRecommendedGracefulStopTimeout; + private Timeticks _minGracefulStopTimeout; + private Map _parameter; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public OperateVnfOpConfigBuilder() { + } + + public OperateVnfOpConfigBuilder(OperateVnfOpConfig base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._maxRecommendedGracefulStopTimeout = base.getMaxRecommendedGracefulStopTimeout(); + this._minGracefulStopTimeout = base.getMinGracefulStopTimeout(); + this._parameter = base.getParameter(); + } + + + public Timeticks getMaxRecommendedGracefulStopTimeout() { + return _maxRecommendedGracefulStopTimeout; + } + + public Timeticks getMinGracefulStopTimeout() { + return _minGracefulStopTimeout; + } + + public Map getParameter() { + return _parameter; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public OperateVnfOpConfigBuilder setMaxRecommendedGracefulStopTimeout(final Timeticks value) { + this._maxRecommendedGracefulStopTimeout = value; + return this; + } + + public OperateVnfOpConfigBuilder setMinGracefulStopTimeout(final Timeticks value) { + this._minGracefulStopTimeout = value; + return this; + } + public OperateVnfOpConfigBuilder setParameter(final Map values) { + this._parameter = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setParameter(Map)} instead. + */ + @Deprecated(forRemoval = true) + public OperateVnfOpConfigBuilder setParameter(final List values) { + return setParameter(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public OperateVnfOpConfigBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public OperateVnfOpConfigBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public OperateVnfOpConfigBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private OperateVnfOpConfigBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public OperateVnfOpConfig build() { + return new OperateVnfOpConfigImpl(this); + } + + private static final class OperateVnfOpConfigImpl + extends AbstractAugmentable + implements OperateVnfOpConfig { + + private final Timeticks _maxRecommendedGracefulStopTimeout; + private final Timeticks _minGracefulStopTimeout; + private final Map _parameter; + + OperateVnfOpConfigImpl(OperateVnfOpConfigBuilder base) { + super(base.augmentation); + this._maxRecommendedGracefulStopTimeout = base.getMaxRecommendedGracefulStopTimeout(); + this._minGracefulStopTimeout = base.getMinGracefulStopTimeout(); + this._parameter = CodeHelpers.emptyToNull(base.getParameter()); + } + + @Override + public Timeticks getMaxRecommendedGracefulStopTimeout() { + return _maxRecommendedGracefulStopTimeout; + } + + @Override + public Timeticks getMinGracefulStopTimeout() { + return _minGracefulStopTimeout; + } + + @Override + public Map getParameter() { + return _parameter; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_maxRecommendedGracefulStopTimeout); + result = prime * result + Objects.hashCode(_minGracefulStopTimeout); + result = prime * result + Objects.hashCode(_parameter); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!OperateVnfOpConfig.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + OperateVnfOpConfig other = (OperateVnfOpConfig)obj; + if (!Objects.equals(_maxRecommendedGracefulStopTimeout, other.getMaxRecommendedGracefulStopTimeout())) { + return false; + } + if (!Objects.equals(_minGracefulStopTimeout, other.getMinGracefulStopTimeout())) { + return false; + } + if (!Objects.equals(_parameter, other.getParameter())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + OperateVnfOpConfigImpl otherImpl = (OperateVnfOpConfigImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("OperateVnfOpConfig"); + CodeHelpers.appendValue(helper, "_maxRecommendedGracefulStopTimeout", _maxRecommendedGracefulStopTimeout); + CodeHelpers.appendValue(helper, "_minGracefulStopTimeout", _minGracefulStopTimeout); + CodeHelpers.appendValue(helper, "_parameter", _parameter); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfOpConfig.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfOpConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..bc81277ca5e6b152fc762bcffdd624a4d80dc0ef --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfOpConfig.java @@ -0,0 +1,89 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.op.config.ParameterKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Configuration parameters for the ScaleVnf operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container scale-vnf-op-config {
+ *   list parameter {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ *   leaf scaling-by-more-than-one-step-supported {
+ *     type boolean;
+ *     default false;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/scale-vnf-op-config + * + *

To create instances of this class use {@link ScaleVnfOpConfigBuilder}. + * @see ScaleVnfOpConfigBuilder + * + */ +public interface ScaleVnfOpConfig + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("scale-vnf-op-config"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ScaleVnfOpConfig.class; + } + + /** + * Array of KVP requirements for VNFspecific parameters to be passed when invoking + * the ScaleVnf operation. + * + * + * + * @return java.util.Map parameter, or null if not present + */ + @Nullable Map getParameter(); + + /** + * @return java.util.Map parameter, or an empty list if it is not present + */ + default @NonNull Map nonnullParameter() { + return CodeHelpers.nonnull(getParameter()); + } + + /** + * Signals whether passing a value larger than one in the numScalingSteps parameter + * of the ScaleVnf operation is supported by this VNF. Default is FALSE, i.e. 'not + * supported'. + * + * + * + * @return java.lang.Boolean scalingByMoreThanOneStepSupported, or null if not present + */ + @Nullable Boolean isScalingByMoreThanOneStepSupported(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfOpConfigBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfOpConfigBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..4b6ca3e6483fe267c741a803674640bb8bc97796 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfOpConfigBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.op.config.ParameterKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ScaleVnfOpConfigBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ScaleVnfOpConfigBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ScaleVnfOpConfigBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ScaleVnfOpConfigBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ScaleVnfOpConfigBuilder + * @see Builder + * + */ +public class ScaleVnfOpConfigBuilder implements Builder { + + private Map _parameter; + private Boolean _scalingByMoreThanOneStepSupported; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ScaleVnfOpConfigBuilder() { + } + + public ScaleVnfOpConfigBuilder(ScaleVnfOpConfig base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._parameter = base.getParameter(); + this._scalingByMoreThanOneStepSupported = base.isScalingByMoreThanOneStepSupported(); + } + + + public Map getParameter() { + return _parameter; + } + + public Boolean isScalingByMoreThanOneStepSupported() { + return _scalingByMoreThanOneStepSupported; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ScaleVnfOpConfigBuilder setParameter(final Map values) { + this._parameter = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setParameter(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ScaleVnfOpConfigBuilder setParameter(final List values) { + return setParameter(CodeHelpers.compatMap(values)); + } + + public ScaleVnfOpConfigBuilder setScalingByMoreThanOneStepSupported(final Boolean value) { + this._scalingByMoreThanOneStepSupported = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ScaleVnfOpConfigBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ScaleVnfOpConfigBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ScaleVnfOpConfigBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ScaleVnfOpConfigBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ScaleVnfOpConfig build() { + return new ScaleVnfOpConfigImpl(this); + } + + private static final class ScaleVnfOpConfigImpl + extends AbstractAugmentable + implements ScaleVnfOpConfig { + + private final Map _parameter; + private final Boolean _scalingByMoreThanOneStepSupported; + + ScaleVnfOpConfigImpl(ScaleVnfOpConfigBuilder base) { + super(base.augmentation); + this._parameter = CodeHelpers.emptyToNull(base.getParameter()); + this._scalingByMoreThanOneStepSupported = base.isScalingByMoreThanOneStepSupported(); + } + + @Override + public Map getParameter() { + return _parameter; + } + + @Override + public Boolean isScalingByMoreThanOneStepSupported() { + return _scalingByMoreThanOneStepSupported; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_parameter); + result = prime * result + Objects.hashCode(_scalingByMoreThanOneStepSupported); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ScaleVnfOpConfig.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ScaleVnfOpConfig other = (ScaleVnfOpConfig)obj; + if (!Objects.equals(_parameter, other.getParameter())) { + return false; + } + if (!Objects.equals(_scalingByMoreThanOneStepSupported, other.isScalingByMoreThanOneStepSupported())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ScaleVnfOpConfigImpl otherImpl = (ScaleVnfOpConfigImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ScaleVnfOpConfig"); + CodeHelpers.appendValue(helper, "_parameter", _parameter); + CodeHelpers.appendValue(helper, "_scalingByMoreThanOneStepSupported", _scalingByMoreThanOneStepSupported); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfToLevelOpConfig.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfToLevelOpConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..e671466d541dada72dc231a1ce9e8ad44eeac47a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfToLevelOpConfig.java @@ -0,0 +1,89 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.to.level.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.to.level.op.config.ParameterKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This information element defines attributes that affect the invocation of the + * ScaleVnfToLevel operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container scale-vnf-to-level-op-config {
+ *   list parameter {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ *   leaf arbitrary-target-levels-supported {
+ *     type boolean;
+ *     default false;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/scale-vnf-to-level-op-config + * + *

To create instances of this class use {@link ScaleVnfToLevelOpConfigBuilder}. + * @see ScaleVnfToLevelOpConfigBuilder + * + */ +public interface ScaleVnfToLevelOpConfig + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("scale-vnf-to-level-op-config"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ScaleVnfToLevelOpConfig.class; + } + + /** + * Array of KVP requirements for VNF-specific parameters to be passed when invoking + * the ScaleVnfToLevel operation. + * + * + * + * @return java.util.Map parameter, or null if not present + */ + @Nullable Map getParameter(); + + /** + * @return java.util.Map parameter, or an empty list if it is not present + */ + default @NonNull Map nonnullParameter() { + return CodeHelpers.nonnull(getParameter()); + } + + /** + * Signals whether scaling according to the parameter 'scaleInfo' is supported by + * this VNF. + * + * + * + * @return java.lang.Boolean arbitraryTargetLevelsSupported, or null if not present + */ + @Nullable Boolean isArbitraryTargetLevelsSupported(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfToLevelOpConfigBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfToLevelOpConfigBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..918160a0829bf8c2f34fdba7cb85fdf801005cfe --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/ScaleVnfToLevelOpConfigBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.to.level.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.to.level.op.config.ParameterKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ScaleVnfToLevelOpConfigBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ScaleVnfToLevelOpConfigBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ScaleVnfToLevelOpConfigBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ScaleVnfToLevelOpConfigBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ScaleVnfToLevelOpConfigBuilder + * @see Builder + * + */ +public class ScaleVnfToLevelOpConfigBuilder implements Builder { + + private Map _parameter; + private Boolean _arbitraryTargetLevelsSupported; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ScaleVnfToLevelOpConfigBuilder() { + } + + public ScaleVnfToLevelOpConfigBuilder(ScaleVnfToLevelOpConfig base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._parameter = base.getParameter(); + this._arbitraryTargetLevelsSupported = base.isArbitraryTargetLevelsSupported(); + } + + + public Map getParameter() { + return _parameter; + } + + public Boolean isArbitraryTargetLevelsSupported() { + return _arbitraryTargetLevelsSupported; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ScaleVnfToLevelOpConfigBuilder setParameter(final Map values) { + this._parameter = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setParameter(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ScaleVnfToLevelOpConfigBuilder setParameter(final List values) { + return setParameter(CodeHelpers.compatMap(values)); + } + + public ScaleVnfToLevelOpConfigBuilder setArbitraryTargetLevelsSupported(final Boolean value) { + this._arbitraryTargetLevelsSupported = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ScaleVnfToLevelOpConfigBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ScaleVnfToLevelOpConfigBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ScaleVnfToLevelOpConfigBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ScaleVnfToLevelOpConfigBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ScaleVnfToLevelOpConfig build() { + return new ScaleVnfToLevelOpConfigImpl(this); + } + + private static final class ScaleVnfToLevelOpConfigImpl + extends AbstractAugmentable + implements ScaleVnfToLevelOpConfig { + + private final Map _parameter; + private final Boolean _arbitraryTargetLevelsSupported; + + ScaleVnfToLevelOpConfigImpl(ScaleVnfToLevelOpConfigBuilder base) { + super(base.augmentation); + this._parameter = CodeHelpers.emptyToNull(base.getParameter()); + this._arbitraryTargetLevelsSupported = base.isArbitraryTargetLevelsSupported(); + } + + @Override + public Map getParameter() { + return _parameter; + } + + @Override + public Boolean isArbitraryTargetLevelsSupported() { + return _arbitraryTargetLevelsSupported; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_parameter); + result = prime * result + Objects.hashCode(_arbitraryTargetLevelsSupported); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ScaleVnfToLevelOpConfig.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ScaleVnfToLevelOpConfig other = (ScaleVnfToLevelOpConfig)obj; + if (!Objects.equals(_parameter, other.getParameter())) { + return false; + } + if (!Objects.equals(_arbitraryTargetLevelsSupported, other.isArbitraryTargetLevelsSupported())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ScaleVnfToLevelOpConfigImpl otherImpl = (ScaleVnfToLevelOpConfigImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ScaleVnfToLevelOpConfig"); + CodeHelpers.appendValue(helper, "_parameter", _parameter); + CodeHelpers.appendValue(helper, "_arbitraryTargetLevelsSupported", _arbitraryTargetLevelsSupported); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/TerminateVnfOpConfig.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/TerminateVnfOpConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..2ab67c146bd918ce2a541c03701dd4434e75fc15 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/TerminateVnfOpConfig.java @@ -0,0 +1,104 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.LcmOperationsConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.terminate.vnf.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.terminate.vnf.op.config.ParameterKey; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * This information element defines attributes that affect the invocation of the + * TerminateVnf operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container terminate-vnf-op-config {
+ *   leaf min-graceful-termination {
+ *     type yang:timeticks;
+ *     default 1;
+ *   }
+ *   leaf max-recommended-graceful-termination {
+ *     type yang:timeticks;
+ *   }
+ *   list parameter {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/terminate-vnf-op-config + * + *

To create instances of this class use {@link TerminateVnfOpConfigBuilder}. + * @see TerminateVnfOpConfigBuilder + * + */ +public interface TerminateVnfOpConfig + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("terminate-vnf-op-config"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.TerminateVnfOpConfig.class; + } + + /** + * Minimum timeout value for graceful termination of a VNF instance. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks minGracefulTermination, or null if not present + */ + @Nullable Timeticks getMinGracefulTermination(); + + /** + * Maximum recommended timeout value that can be needed to gracefully terminate a + * VNF instance of a particular type under certain conditions, such as maximum load + * condition. This is provided by VNF provider as information for the operator + * facilitating the selection of optimal timeout value. This value is not used as + * constraint. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks maxRecommendedGracefulTermination, or null if not present + */ + @Nullable Timeticks getMaxRecommendedGracefulTermination(); + + /** + * Array of KVP requirements for VNF-specific parameters to be passed when invoking + * the TerminateVnf operation. + * + * + * + * @return java.util.Map parameter, or null if not present + */ + @Nullable Map getParameter(); + + /** + * @return java.util.Map parameter, or an empty list if it is not present + */ + default @NonNull Map nonnullParameter() { + return CodeHelpers.nonnull(getParameter()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/TerminateVnfOpConfigBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/TerminateVnfOpConfigBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..856bf8dd60ca53cb98d9814877723635ed934cd7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/TerminateVnfOpConfigBuilder.java @@ -0,0 +1,294 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.terminate.vnf.op.config.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.terminate.vnf.op.config.ParameterKey; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timeticks; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link TerminateVnfOpConfigBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     TerminateVnfOpConfigBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new TerminateVnfOpConfigBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of TerminateVnfOpConfigBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see TerminateVnfOpConfigBuilder + * @see Builder + * + */ +public class TerminateVnfOpConfigBuilder implements Builder { + + private Timeticks _maxRecommendedGracefulTermination; + private Timeticks _minGracefulTermination; + private Map _parameter; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public TerminateVnfOpConfigBuilder() { + } + + public TerminateVnfOpConfigBuilder(TerminateVnfOpConfig base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._maxRecommendedGracefulTermination = base.getMaxRecommendedGracefulTermination(); + this._minGracefulTermination = base.getMinGracefulTermination(); + this._parameter = base.getParameter(); + } + + + public Timeticks getMaxRecommendedGracefulTermination() { + return _maxRecommendedGracefulTermination; + } + + public Timeticks getMinGracefulTermination() { + return _minGracefulTermination; + } + + public Map getParameter() { + return _parameter; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public TerminateVnfOpConfigBuilder setMaxRecommendedGracefulTermination(final Timeticks value) { + this._maxRecommendedGracefulTermination = value; + return this; + } + + public TerminateVnfOpConfigBuilder setMinGracefulTermination(final Timeticks value) { + this._minGracefulTermination = value; + return this; + } + public TerminateVnfOpConfigBuilder setParameter(final Map values) { + this._parameter = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setParameter(Map)} instead. + */ + @Deprecated(forRemoval = true) + public TerminateVnfOpConfigBuilder setParameter(final List values) { + return setParameter(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public TerminateVnfOpConfigBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public TerminateVnfOpConfigBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public TerminateVnfOpConfigBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private TerminateVnfOpConfigBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public TerminateVnfOpConfig build() { + return new TerminateVnfOpConfigImpl(this); + } + + private static final class TerminateVnfOpConfigImpl + extends AbstractAugmentable + implements TerminateVnfOpConfig { + + private final Timeticks _maxRecommendedGracefulTermination; + private final Timeticks _minGracefulTermination; + private final Map _parameter; + + TerminateVnfOpConfigImpl(TerminateVnfOpConfigBuilder base) { + super(base.augmentation); + this._maxRecommendedGracefulTermination = base.getMaxRecommendedGracefulTermination(); + this._minGracefulTermination = base.getMinGracefulTermination(); + this._parameter = CodeHelpers.emptyToNull(base.getParameter()); + } + + @Override + public Timeticks getMaxRecommendedGracefulTermination() { + return _maxRecommendedGracefulTermination; + } + + @Override + public Timeticks getMinGracefulTermination() { + return _minGracefulTermination; + } + + @Override + public Map getParameter() { + return _parameter; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_maxRecommendedGracefulTermination); + result = prime * result + Objects.hashCode(_minGracefulTermination); + result = prime * result + Objects.hashCode(_parameter); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!TerminateVnfOpConfig.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + TerminateVnfOpConfig other = (TerminateVnfOpConfig)obj; + if (!Objects.equals(_maxRecommendedGracefulTermination, other.getMaxRecommendedGracefulTermination())) { + return false; + } + if (!Objects.equals(_minGracefulTermination, other.getMinGracefulTermination())) { + return false; + } + if (!Objects.equals(_parameter, other.getParameter())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + TerminateVnfOpConfigImpl otherImpl = (TerminateVnfOpConfigImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("TerminateVnfOpConfig"); + CodeHelpers.appendValue(helper, "_maxRecommendedGracefulTermination", _maxRecommendedGracefulTermination); + CodeHelpers.appendValue(helper, "_minGracefulTermination", _minGracefulTermination); + CodeHelpers.appendValue(helper, "_parameter", _parameter); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/ext/vnf/connectivity/op/config/Parameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/ext/vnf/connectivity/op/config/Parameter.java new file mode 100644 index 0000000000000000000000000000000000000000..9cd95678399df34ee3f68f5660dc6eb67e6c1875 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/ext/vnf/connectivity/op/config/Parameter.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.ext.vnf.connectivity.op.config; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ChangeExtVnfConnectivityOpConfig; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of KVP requirements for VNF-specific parameters to be passed when + * the ChangeExtVnfConnectivity operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list parameter {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/change-ext-vnf-connectivity-op-config/parameter + * + *

To create instances of this class use {@link ParameterBuilder}. + * @see ParameterBuilder + * @see ParameterKey + * + */ +public interface Parameter + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("parameter"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.ext.vnf.connectivity.op.config.Parameter.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + ParameterKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/ext/vnf/connectivity/op/config/ParameterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/ext/vnf/connectivity/op/config/ParameterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..7091e93342382ec84f8e190743df834a43ee19ce --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/ext/vnf/connectivity/op/config/ParameterBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.ext.vnf.connectivity.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ParameterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ParameterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ParameterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ParameterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ParameterBuilder + * @see Builder + * + */ +public class ParameterBuilder implements Builder { + + private String _key; + private String _value; + private ParameterKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ParameterBuilder() { + } + + public ParameterBuilder(Parameter base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public ParameterKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ParameterBuilder withKey(final ParameterKey key) { + this.key = key; + return this; + } + + public ParameterBuilder setKey(final String value) { + this._key = value; + return this; + } + + public ParameterBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ParameterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ParameterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ParameterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ParameterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Parameter build() { + return new ParameterImpl(this); + } + + private static final class ParameterImpl + extends AbstractAugmentable + implements Parameter { + + private final String _key; + private final String _value; + private final ParameterKey key; + + ParameterImpl(ParameterBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ParameterKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public ParameterKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Parameter.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Parameter other = (Parameter)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ParameterImpl otherImpl = (ParameterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Parameter"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/ext/vnf/connectivity/op/config/ParameterKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/ext/vnf/connectivity/op/config/ParameterKey.java new file mode 100644 index 0000000000000000000000000000000000000000..5141052768c4b8f6e1fd04e7120515257dd8157d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/ext/vnf/connectivity/op/config/ParameterKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.ext.vnf.connectivity.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ParameterKey + implements Identifier { + private static final long serialVersionUID = 8946355449704281588L; + private final String _key; + + + public ParameterKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ParameterKey(ParameterKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ParameterKey)) { + return false; + } + final ParameterKey other = (ParameterKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ParameterKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/vnf/flavour/op/config/Parameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/vnf/flavour/op/config/Parameter.java new file mode 100644 index 0000000000000000000000000000000000000000..24786be01d667ef6403cd873b0750b314e51a46a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/vnf/flavour/op/config/Parameter.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.vnf.flavour.op.config; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ChangeVnfFlavourOpConfig; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of KVP requirements for VNF-specific parameters to be passed when + * the OperateVnf operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list parameter {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/change-vnf-flavour-op-config/parameter + * + *

To create instances of this class use {@link ParameterBuilder}. + * @see ParameterBuilder + * @see ParameterKey + * + */ +public interface Parameter + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("parameter"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.vnf.flavour.op.config.Parameter.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + ParameterKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/vnf/flavour/op/config/ParameterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/vnf/flavour/op/config/ParameterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..02feffd7b0c4ec2276f9c66c27af55fa51b1c49e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/vnf/flavour/op/config/ParameterBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.vnf.flavour.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ParameterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ParameterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ParameterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ParameterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ParameterBuilder + * @see Builder + * + */ +public class ParameterBuilder implements Builder { + + private String _key; + private String _value; + private ParameterKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ParameterBuilder() { + } + + public ParameterBuilder(Parameter base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public ParameterKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ParameterBuilder withKey(final ParameterKey key) { + this.key = key; + return this; + } + + public ParameterBuilder setKey(final String value) { + this._key = value; + return this; + } + + public ParameterBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ParameterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ParameterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ParameterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ParameterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Parameter build() { + return new ParameterImpl(this); + } + + private static final class ParameterImpl + extends AbstractAugmentable + implements Parameter { + + private final String _key; + private final String _value; + private final ParameterKey key; + + ParameterImpl(ParameterBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ParameterKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public ParameterKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Parameter.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Parameter other = (Parameter)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ParameterImpl otherImpl = (ParameterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Parameter"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/vnf/flavour/op/config/ParameterKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/vnf/flavour/op/config/ParameterKey.java new file mode 100644 index 0000000000000000000000000000000000000000..b4cb41d332e0b887d67d3f1027424584ba34c5d6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/change/vnf/flavour/op/config/ParameterKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.change.vnf.flavour.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ParameterKey + implements Identifier { + private static final long serialVersionUID = 8946355449704281588L; + private final String _key; + + + public ParameterKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ParameterKey(ParameterKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ParameterKey)) { + return false; + } + final ParameterKey other = (ParameterKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ParameterKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/heal/vnf/op/config/Parameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/heal/vnf/op/config/Parameter.java new file mode 100644 index 0000000000000000000000000000000000000000..537aa1198c7bd1ec4d7b7e40fc2f52e389c1f7fe --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/heal/vnf/op/config/Parameter.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.heal.vnf.op.config; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.HealVnfOpConfig; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of KVP requirements for VNF-specific parameters to be passed when + * the HealVnf operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list parameter {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/heal-vnf-op-config/parameter + * + *

To create instances of this class use {@link ParameterBuilder}. + * @see ParameterBuilder + * @see ParameterKey + * + */ +public interface Parameter + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("parameter"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.heal.vnf.op.config.Parameter.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + ParameterKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/heal/vnf/op/config/ParameterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/heal/vnf/op/config/ParameterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..d59daa9c6e313067b1bd943908933104404ec4ee --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/heal/vnf/op/config/ParameterBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.heal.vnf.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ParameterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ParameterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ParameterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ParameterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ParameterBuilder + * @see Builder + * + */ +public class ParameterBuilder implements Builder { + + private String _key; + private String _value; + private ParameterKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ParameterBuilder() { + } + + public ParameterBuilder(Parameter base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public ParameterKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ParameterBuilder withKey(final ParameterKey key) { + this.key = key; + return this; + } + + public ParameterBuilder setKey(final String value) { + this._key = value; + return this; + } + + public ParameterBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ParameterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ParameterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ParameterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ParameterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Parameter build() { + return new ParameterImpl(this); + } + + private static final class ParameterImpl + extends AbstractAugmentable + implements Parameter { + + private final String _key; + private final String _value; + private final ParameterKey key; + + ParameterImpl(ParameterBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ParameterKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public ParameterKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Parameter.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Parameter other = (Parameter)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ParameterImpl otherImpl = (ParameterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Parameter"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/heal/vnf/op/config/ParameterKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/heal/vnf/op/config/ParameterKey.java new file mode 100644 index 0000000000000000000000000000000000000000..68e9fe12a90f21facb8d5f46cacded064ae764a5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/heal/vnf/op/config/ParameterKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.heal.vnf.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ParameterKey + implements Identifier { + private static final long serialVersionUID = 8946355449704281588L; + private final String _key; + + + public ParameterKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ParameterKey(ParameterKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ParameterKey)) { + return false; + } + final ParameterKey other = (ParameterKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ParameterKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/instantiate/vnf/op/config/Parameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/instantiate/vnf/op/config/Parameter.java new file mode 100644 index 0000000000000000000000000000000000000000..7ae9b8880a9443aba9c4f8380b575f32315d1989 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/instantiate/vnf/op/config/Parameter.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.instantiate.vnf.op.config; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.InstantiateVnfOpConfig; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of KVP requirements for VNF-specific parameters to be passed when + * the InstantiateVnf operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list parameter {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/instantiate-vnf-op-config/parameter + * + *

To create instances of this class use {@link ParameterBuilder}. + * @see ParameterBuilder + * @see ParameterKey + * + */ +public interface Parameter + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("parameter"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.instantiate.vnf.op.config.Parameter.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + ParameterKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/instantiate/vnf/op/config/ParameterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/instantiate/vnf/op/config/ParameterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..1011d86bdc007d846584b9f364e9df824d2b2db2 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/instantiate/vnf/op/config/ParameterBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.instantiate.vnf.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ParameterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ParameterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ParameterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ParameterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ParameterBuilder + * @see Builder + * + */ +public class ParameterBuilder implements Builder { + + private String _key; + private String _value; + private ParameterKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ParameterBuilder() { + } + + public ParameterBuilder(Parameter base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public ParameterKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ParameterBuilder withKey(final ParameterKey key) { + this.key = key; + return this; + } + + public ParameterBuilder setKey(final String value) { + this._key = value; + return this; + } + + public ParameterBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ParameterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ParameterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ParameterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ParameterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Parameter build() { + return new ParameterImpl(this); + } + + private static final class ParameterImpl + extends AbstractAugmentable + implements Parameter { + + private final String _key; + private final String _value; + private final ParameterKey key; + + ParameterImpl(ParameterBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ParameterKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public ParameterKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Parameter.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Parameter other = (Parameter)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ParameterImpl otherImpl = (ParameterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Parameter"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/instantiate/vnf/op/config/ParameterKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/instantiate/vnf/op/config/ParameterKey.java new file mode 100644 index 0000000000000000000000000000000000000000..ac48d145bd5e817c58b58e83059a1b1f41e7559c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/instantiate/vnf/op/config/ParameterKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.instantiate.vnf.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ParameterKey + implements Identifier { + private static final long serialVersionUID = 8946355449704281588L; + private final String _key; + + + public ParameterKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ParameterKey(ParameterKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ParameterKey)) { + return false; + } + final ParameterKey other = (ParameterKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ParameterKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/operate/vnf/op/config/Parameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/operate/vnf/op/config/Parameter.java new file mode 100644 index 0000000000000000000000000000000000000000..4400bd618143bc7466d62526a621eb545bf4b882 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/operate/vnf/op/config/Parameter.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.operate.vnf.op.config; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.OperateVnfOpConfig; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of KVP requirements for VNF-specific parameters to be passed when + * the OperateVnf operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list parameter {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/operate-vnf-op-config/parameter + * + *

To create instances of this class use {@link ParameterBuilder}. + * @see ParameterBuilder + * @see ParameterKey + * + */ +public interface Parameter + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("parameter"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.operate.vnf.op.config.Parameter.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + ParameterKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/operate/vnf/op/config/ParameterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/operate/vnf/op/config/ParameterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..4eccc6b58f2b494e786a1a447fe8db0df0de3a0e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/operate/vnf/op/config/ParameterBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.operate.vnf.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ParameterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ParameterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ParameterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ParameterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ParameterBuilder + * @see Builder + * + */ +public class ParameterBuilder implements Builder { + + private String _key; + private String _value; + private ParameterKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ParameterBuilder() { + } + + public ParameterBuilder(Parameter base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public ParameterKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ParameterBuilder withKey(final ParameterKey key) { + this.key = key; + return this; + } + + public ParameterBuilder setKey(final String value) { + this._key = value; + return this; + } + + public ParameterBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ParameterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ParameterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ParameterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ParameterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Parameter build() { + return new ParameterImpl(this); + } + + private static final class ParameterImpl + extends AbstractAugmentable + implements Parameter { + + private final String _key; + private final String _value; + private final ParameterKey key; + + ParameterImpl(ParameterBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ParameterKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public ParameterKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Parameter.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Parameter other = (Parameter)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ParameterImpl otherImpl = (ParameterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Parameter"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/operate/vnf/op/config/ParameterKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/operate/vnf/op/config/ParameterKey.java new file mode 100644 index 0000000000000000000000000000000000000000..5d6ebe0f97aef40c06648b99136126b69e64786c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/operate/vnf/op/config/ParameterKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.operate.vnf.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ParameterKey + implements Identifier { + private static final long serialVersionUID = 8946355449704281588L; + private final String _key; + + + public ParameterKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ParameterKey(ParameterKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ParameterKey)) { + return false; + } + final ParameterKey other = (ParameterKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ParameterKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/op/config/Parameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/op/config/Parameter.java new file mode 100644 index 0000000000000000000000000000000000000000..73ca7f7638f1f7ae2e7da7d043b9b3d00e6b69fa --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/op/config/Parameter.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.op.config; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ScaleVnfOpConfig; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of KVP requirements for VNFspecific parameters to be passed when invoking + * the ScaleVnf operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list parameter {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/scale-vnf-op-config/parameter + * + *

To create instances of this class use {@link ParameterBuilder}. + * @see ParameterBuilder + * @see ParameterKey + * + */ +public interface Parameter + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("parameter"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.op.config.Parameter.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + ParameterKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/op/config/ParameterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/op/config/ParameterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..718c9fa4a49ec060f718dca33927ae4c5d6635ca --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/op/config/ParameterBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ParameterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ParameterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ParameterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ParameterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ParameterBuilder + * @see Builder + * + */ +public class ParameterBuilder implements Builder { + + private String _key; + private String _value; + private ParameterKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ParameterBuilder() { + } + + public ParameterBuilder(Parameter base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public ParameterKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ParameterBuilder withKey(final ParameterKey key) { + this.key = key; + return this; + } + + public ParameterBuilder setKey(final String value) { + this._key = value; + return this; + } + + public ParameterBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ParameterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ParameterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ParameterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ParameterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Parameter build() { + return new ParameterImpl(this); + } + + private static final class ParameterImpl + extends AbstractAugmentable + implements Parameter { + + private final String _key; + private final String _value; + private final ParameterKey key; + + ParameterImpl(ParameterBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ParameterKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public ParameterKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Parameter.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Parameter other = (Parameter)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ParameterImpl otherImpl = (ParameterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Parameter"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/op/config/ParameterKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/op/config/ParameterKey.java new file mode 100644 index 0000000000000000000000000000000000000000..f7edc1305e01836fb4a5bf1ee738582c8dbd828b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/op/config/ParameterKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ParameterKey + implements Identifier { + private static final long serialVersionUID = 8946355449704281588L; + private final String _key; + + + public ParameterKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ParameterKey(ParameterKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ParameterKey)) { + return false; + } + final ParameterKey other = (ParameterKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ParameterKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/to/level/op/config/Parameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/to/level/op/config/Parameter.java new file mode 100644 index 0000000000000000000000000000000000000000..22f53568b2b1e7047c84293d50accb20d85260cf --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/to/level/op/config/Parameter.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.to.level.op.config; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.ScaleVnfToLevelOpConfig; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of KVP requirements for VNF-specific parameters to be passed when + * the ScaleVnfToLevel operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list parameter {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/scale-vnf-to-level-op-config/parameter + * + *

To create instances of this class use {@link ParameterBuilder}. + * @see ParameterBuilder + * @see ParameterKey + * + */ +public interface Parameter + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("parameter"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.to.level.op.config.Parameter.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + ParameterKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/to/level/op/config/ParameterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/to/level/op/config/ParameterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..cf2061e00b6ac357ddb5e0177d283c1e8d164bed --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/to/level/op/config/ParameterBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.to.level.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ParameterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ParameterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ParameterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ParameterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ParameterBuilder + * @see Builder + * + */ +public class ParameterBuilder implements Builder { + + private String _key; + private String _value; + private ParameterKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ParameterBuilder() { + } + + public ParameterBuilder(Parameter base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public ParameterKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ParameterBuilder withKey(final ParameterKey key) { + this.key = key; + return this; + } + + public ParameterBuilder setKey(final String value) { + this._key = value; + return this; + } + + public ParameterBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ParameterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ParameterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ParameterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ParameterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Parameter build() { + return new ParameterImpl(this); + } + + private static final class ParameterImpl + extends AbstractAugmentable + implements Parameter { + + private final String _key; + private final String _value; + private final ParameterKey key; + + ParameterImpl(ParameterBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ParameterKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public ParameterKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Parameter.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Parameter other = (Parameter)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ParameterImpl otherImpl = (ParameterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Parameter"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/to/level/op/config/ParameterKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/to/level/op/config/ParameterKey.java new file mode 100644 index 0000000000000000000000000000000000000000..ab1489ae5f9136b7fb5f9df4954b5c368c9fe85a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/scale/vnf/to/level/op/config/ParameterKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.scale.vnf.to.level.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ParameterKey + implements Identifier { + private static final long serialVersionUID = 8946355449704281588L; + private final String _key; + + + public ParameterKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ParameterKey(ParameterKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ParameterKey)) { + return false; + } + final ParameterKey other = (ParameterKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ParameterKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/terminate/vnf/op/config/Parameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/terminate/vnf/op/config/Parameter.java new file mode 100644 index 0000000000000000000000000000000000000000..cb7b69e932c3003311d44ec051c2197ac54d512f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/terminate/vnf/op/config/Parameter.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.terminate.vnf.op.config; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.TerminateVnfOpConfig; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of KVP requirements for VNF-specific parameters to be passed when + * the TerminateVnf operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list parameter {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/lcm-operations-configuration/terminate-vnf-op-config/parameter + * + *

To create instances of this class use {@link ParameterBuilder}. + * @see ParameterBuilder + * @see ParameterKey + * + */ +public interface Parameter + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("parameter"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.terminate.vnf.op.config.Parameter.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + ParameterKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/terminate/vnf/op/config/ParameterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/terminate/vnf/op/config/ParameterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..be9b4145cd30a1bc70d69b00f55a1196c9fb2a4b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/terminate/vnf/op/config/ParameterBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.terminate.vnf.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ParameterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ParameterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ParameterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ParameterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ParameterBuilder + * @see Builder + * + */ +public class ParameterBuilder implements Builder { + + private String _key; + private String _value; + private ParameterKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ParameterBuilder() { + } + + public ParameterBuilder(Parameter base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public ParameterKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ParameterBuilder withKey(final ParameterKey key) { + this.key = key; + return this; + } + + public ParameterBuilder setKey(final String value) { + this._key = value; + return this; + } + + public ParameterBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ParameterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ParameterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ParameterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ParameterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Parameter build() { + return new ParameterImpl(this); + } + + private static final class ParameterImpl + extends AbstractAugmentable + implements Parameter { + + private final String _key; + private final String _value; + private final ParameterKey key; + + ParameterImpl(ParameterBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ParameterKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public ParameterKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Parameter.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Parameter other = (Parameter)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ParameterImpl otherImpl = (ParameterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Parameter"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/terminate/vnf/op/config/ParameterKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/terminate/vnf/op/config/ParameterKey.java new file mode 100644 index 0000000000000000000000000000000000000000..95a215fabbd16231138ebf8fbc65fa8fe9f7de9e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/lcm/operations/configuration/terminate/vnf/op/config/ParameterKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.terminate.vnf.op.config; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ParameterKey + implements Identifier { + private static final long serialVersionUID = 8946355449704281588L; + private final String _key; + + + public ParameterKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ParameterKey(ParameterKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ParameterKey)) { + return false; + } + final ParameterKey other = (ParameterKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ParameterKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/AspectDeltaDetails.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/AspectDeltaDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..5e7f60ed722ea435f3b6c88722b40899118673e6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/AspectDeltaDetails.java @@ -0,0 +1,126 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.ScalingAspect; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.Deltas; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.DeltasKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * A specification of the deltas in terms of number of instances of VNFCs and + * virtual link bit rates that correspond to the scaling steps of this aspect. A + * cardinality of zero indicates that this mapping has to be specified in a + * lifecycle management script or be otherwise known to the VNFM. The information + * in this attribute, if provided, shall be consistent with the information + * provided in the 'InstantiationLevel' information element. If this attribute is + * provided, it shall be provided for all scaling aspects. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container aspect-delta-details {
+ *   list deltas {
+ *     key id;
+ *     min-elements 1;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     list vdu-delta {
+ *       key id;
+ *       leaf id {
+ *         type leafref {
+ *           path ../../../../../../vdu/id;
+ *         }
+ *       }
+ *       leaf number-of-instances {
+ *         type uint32 {
+ *           range 0..max;
+ *         }
+ *       }
+ *     }
+ *     list virtual-link-bit-rate-delta {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       container bit-rate-requirements {
+ *         leaf root {
+ *           type uint32;
+ *           units bits/sec;
+ *         }
+ *         leaf leaf {
+ *           type uint32;
+ *           units bits/sec;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   leaf step-deltas {
+ *     type leafref {
+ *       path ../deltas/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/scaling-aspect/aspect-delta-details + * + *

To create instances of this class use {@link AspectDeltaDetailsBuilder}. + * @see AspectDeltaDetailsBuilder + * + */ +public interface AspectDeltaDetails + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("aspect-delta-details"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.AspectDeltaDetails.class; + } + + /** + * Declares different scaling deltas, each of which is applied for one or more + * scaling steps of this aspect. + * + * + * + * @return java.util.Map deltas, or null if not present + */ + @Nullable Map getDeltas(); + + /** + * @return java.util.Map deltas, or an empty list if it is not present + */ + default @NonNull Map nonnullDeltas() { + return CodeHelpers.nonnull(getDeltas()); + } + + /** + * Identifiers of the individual scaling deltas to be applied for the subsequent + * scaling steps of this aspect. The first entry in the array shall correspond to + * the first scaling step (between scale levels 0 to 1) and the last entry in the + * array shall correspond to the last scaling step (between maxScaleLevel-1 and + * maxScaleLevel). Each referenced scaling delta shall be declared in the 'deltas' + * attribute. + * + * + * + * @return java.lang.String stepDeltas, or null if not present + */ + @Nullable String getStepDeltas(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/AspectDeltaDetailsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/AspectDeltaDetailsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..2107d7e95cb705ff29bf2066b34954a1e6e6704e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/AspectDeltaDetailsBuilder.java @@ -0,0 +1,270 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.Deltas; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.DeltasKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link AspectDeltaDetailsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AspectDeltaDetailsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AspectDeltaDetailsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AspectDeltaDetailsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AspectDeltaDetailsBuilder + * @see Builder + * + */ +public class AspectDeltaDetailsBuilder implements Builder { + + private Map _deltas; + private String _stepDeltas; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AspectDeltaDetailsBuilder() { + } + + public AspectDeltaDetailsBuilder(AspectDeltaDetails base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._deltas = base.getDeltas(); + this._stepDeltas = base.getStepDeltas(); + } + + + public Map getDeltas() { + return _deltas; + } + + public String getStepDeltas() { + return _stepDeltas; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AspectDeltaDetailsBuilder setDeltas(final Map values) { + this._deltas = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setDeltas(Map)} instead. + */ + @Deprecated(forRemoval = true) + public AspectDeltaDetailsBuilder setDeltas(final List values) { + return setDeltas(CodeHelpers.compatMap(values)); + } + + public AspectDeltaDetailsBuilder setStepDeltas(final String value) { + this._stepDeltas = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AspectDeltaDetailsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AspectDeltaDetailsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AspectDeltaDetailsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AspectDeltaDetailsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public AspectDeltaDetails build() { + return new AspectDeltaDetailsImpl(this); + } + + private static final class AspectDeltaDetailsImpl + extends AbstractAugmentable + implements AspectDeltaDetails { + + private final Map _deltas; + private final String _stepDeltas; + + AspectDeltaDetailsImpl(AspectDeltaDetailsBuilder base) { + super(base.augmentation); + this._deltas = CodeHelpers.emptyToNull(base.getDeltas()); + this._stepDeltas = base.getStepDeltas(); + } + + @Override + public Map getDeltas() { + return _deltas; + } + + @Override + public String getStepDeltas() { + return _stepDeltas; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_deltas); + result = prime * result + Objects.hashCode(_stepDeltas); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!AspectDeltaDetails.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + AspectDeltaDetails other = (AspectDeltaDetails)obj; + if (!Objects.equals(_deltas, other.getDeltas())) { + return false; + } + if (!Objects.equals(_stepDeltas, other.getStepDeltas())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AspectDeltaDetailsImpl otherImpl = (AspectDeltaDetailsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("AspectDeltaDetails"); + CodeHelpers.appendValue(helper, "_deltas", _deltas); + CodeHelpers.appendValue(helper, "_stepDeltas", _stepDeltas); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/Deltas.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/Deltas.java new file mode 100644 index 0000000000000000000000000000000000000000..052d04627359e6f9e705112d13309218fb7c8f2f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/Deltas.java @@ -0,0 +1,133 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.AspectDeltaDetails; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.VduDelta; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.VduDeltaKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.VirtualLinkBitRateDelta; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.VirtualLinkBitRateDeltaKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Declares different scaling deltas, each of which is applied for one or more + * scaling steps of this aspect. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list deltas {
+ *   key id;
+ *   min-elements 1;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   list vdu-delta {
+ *     key id;
+ *     leaf id {
+ *       type leafref {
+ *         path ../../../../../../vdu/id;
+ *       }
+ *     }
+ *     leaf number-of-instances {
+ *       type uint32 {
+ *         range 0..max;
+ *       }
+ *     }
+ *   }
+ *   list virtual-link-bit-rate-delta {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     container bit-rate-requirements {
+ *       leaf root {
+ *         type uint32;
+ *         units bits/sec;
+ *       }
+ *       leaf leaf {
+ *         type uint32;
+ *         units bits/sec;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/scaling-aspect/aspect-delta-details/deltas + * + *

To create instances of this class use {@link DeltasBuilder}. + * @see DeltasBuilder + * @see DeltasKey + * + */ +public interface Deltas + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("deltas"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.Deltas.class; + } + + /** + * Identifier of this scaling delta. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * The number of VNFC instances based on particular VDUs to be created or removed. + * + * + * + * @return java.util.Map vduDelta, or null if not present + */ + @Nullable Map getVduDelta(); + + /** + * @return java.util.Map vduDelta, or an empty list if it is not present + */ + default @NonNull Map nonnullVduDelta() { + return CodeHelpers.nonnull(getVduDelta()); + } + + /** + * The bitrate to be added or removed to virtual links created from particular + * virtual link descriptors. + * + * + * + * @return java.util.Map virtualLinkBitRateDelta, or null if not present + */ + @Nullable Map getVirtualLinkBitRateDelta(); + + /** + * @return java.util.Map virtualLinkBitRateDelta, or an empty list if it is not present + */ + default @NonNull Map nonnullVirtualLinkBitRateDelta() { + return CodeHelpers.nonnull(getVirtualLinkBitRateDelta()); + } + + @Override + DeltasKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/DeltasBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/DeltasBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..c015e894d866baa21559122cf260892e20e5a8db --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/DeltasBuilder.java @@ -0,0 +1,333 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.VduDelta; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.VduDeltaKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.VirtualLinkBitRateDelta; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.VirtualLinkBitRateDeltaKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link DeltasBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     DeltasBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new DeltasBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of DeltasBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see DeltasBuilder + * @see Builder + * + */ +public class DeltasBuilder implements Builder { + + private String _id; + private Map _vduDelta; + private Map _virtualLinkBitRateDelta; + private DeltasKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public DeltasBuilder() { + } + + public DeltasBuilder(Deltas base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._vduDelta = base.getVduDelta(); + this._virtualLinkBitRateDelta = base.getVirtualLinkBitRateDelta(); + } + + + public DeltasKey key() { + return key; + } + + public String getId() { + return _id; + } + + public Map getVduDelta() { + return _vduDelta; + } + + public Map getVirtualLinkBitRateDelta() { + return _virtualLinkBitRateDelta; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public DeltasBuilder withKey(final DeltasKey key) { + this.key = key; + return this; + } + + public DeltasBuilder setId(final String value) { + this._id = value; + return this; + } + public DeltasBuilder setVduDelta(final Map values) { + this._vduDelta = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVduDelta(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DeltasBuilder setVduDelta(final List values) { + return setVduDelta(CodeHelpers.compatMap(values)); + } + public DeltasBuilder setVirtualLinkBitRateDelta(final Map values) { + this._virtualLinkBitRateDelta = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualLinkBitRateDelta(Map)} instead. + */ + @Deprecated(forRemoval = true) + public DeltasBuilder setVirtualLinkBitRateDelta(final List values) { + return setVirtualLinkBitRateDelta(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public DeltasBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public DeltasBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public DeltasBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private DeltasBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Deltas build() { + return new DeltasImpl(this); + } + + private static final class DeltasImpl + extends AbstractAugmentable + implements Deltas { + + private final String _id; + private final Map _vduDelta; + private final Map _virtualLinkBitRateDelta; + private final DeltasKey key; + + DeltasImpl(DeltasBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new DeltasKey(base.getId()); + } + this._id = key.getId(); + this._vduDelta = CodeHelpers.emptyToNull(base.getVduDelta()); + this._virtualLinkBitRateDelta = CodeHelpers.emptyToNull(base.getVirtualLinkBitRateDelta()); + } + + @Override + public DeltasKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getVduDelta() { + return _vduDelta; + } + + @Override + public Map getVirtualLinkBitRateDelta() { + return _virtualLinkBitRateDelta; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_vduDelta); + result = prime * result + Objects.hashCode(_virtualLinkBitRateDelta); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Deltas.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Deltas other = (Deltas)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_vduDelta, other.getVduDelta())) { + return false; + } + if (!Objects.equals(_virtualLinkBitRateDelta, other.getVirtualLinkBitRateDelta())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + DeltasImpl otherImpl = (DeltasImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Deltas"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_vduDelta", _vduDelta); + CodeHelpers.appendValue(helper, "_virtualLinkBitRateDelta", _virtualLinkBitRateDelta); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/DeltasKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/DeltasKey.java new file mode 100644 index 0000000000000000000000000000000000000000..64619008902ff27eff6024a124b5c7ca074de440 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/DeltasKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class DeltasKey + implements Identifier { + private static final long serialVersionUID = 2961737683842932339L; + private final String _id; + + + public DeltasKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public DeltasKey(DeltasKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DeltasKey)) { + return false; + } + final DeltasKey other = (DeltasKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(DeltasKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VduDelta.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VduDelta.java new file mode 100644 index 0000000000000000000000000000000000000000..727eed3bb0464743d7c41df7d56ee97151c06abb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VduDelta.java @@ -0,0 +1,81 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.Deltas; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * The number of VNFC instances based on particular VDUs to be created or removed. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list vdu-delta {
+ *   key id;
+ *   leaf id {
+ *     type leafref {
+ *       path ../../../../../../vdu/id;
+ *     }
+ *   }
+ *   leaf number-of-instances {
+ *     type uint32 {
+ *       range 0..max;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/scaling-aspect/aspect-delta-details/deltas/vdu-delta + * + *

To create instances of this class use {@link VduDeltaBuilder}. + * @see VduDeltaBuilder + * @see VduDeltaKey + * + */ +public interface VduDelta + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vdu-delta"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.VduDelta.class; + } + + /** + * Uniquely identifies a VDU. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Number of instances of VNFC based on this VDU to deploy for an instantiation + * level or for a scaling delta. Shall be zero or greater. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 numberOfInstances, or null if not present + */ + @Nullable Uint32 getNumberOfInstances(); + + @Override + VduDeltaKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VduDeltaBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VduDeltaBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..f2479f69cedae64ee2ad2c30220afca2a974e685 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VduDeltaBuilder.java @@ -0,0 +1,292 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link VduDeltaBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VduDeltaBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VduDeltaBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VduDeltaBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VduDeltaBuilder + * @see Builder + * + */ +public class VduDeltaBuilder implements Builder { + + private String _id; + private Uint32 _numberOfInstances; + private VduDeltaKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VduDeltaBuilder() { + } + + public VduDeltaBuilder(VduDelta base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._numberOfInstances = base.getNumberOfInstances(); + } + + + public VduDeltaKey key() { + return key; + } + + public String getId() { + return _id; + } + + public Uint32 getNumberOfInstances() { + return _numberOfInstances; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VduDeltaBuilder withKey(final VduDeltaKey key) { + this.key = key; + return this; + } + + public VduDeltaBuilder setId(final String value) { + this._id = value; + return this; + } + + private static void checkNumberOfInstancesRange(final long value) { + } + + public VduDeltaBuilder setNumberOfInstances(final Uint32 value) { + if (value != null) { + checkNumberOfInstancesRange(value.longValue()); + + } + this._numberOfInstances = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setNumberOfInstances(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public VduDeltaBuilder setNumberOfInstances(final Long value) { + return setNumberOfInstances(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VduDeltaBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VduDeltaBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VduDeltaBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VduDeltaBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VduDelta build() { + return new VduDeltaImpl(this); + } + + private static final class VduDeltaImpl + extends AbstractAugmentable + implements VduDelta { + + private final String _id; + private final Uint32 _numberOfInstances; + private final VduDeltaKey key; + + VduDeltaImpl(VduDeltaBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VduDeltaKey(base.getId()); + } + this._id = key.getId(); + this._numberOfInstances = base.getNumberOfInstances(); + } + + @Override + public VduDeltaKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Uint32 getNumberOfInstances() { + return _numberOfInstances; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_numberOfInstances); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VduDelta.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VduDelta other = (VduDelta)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_numberOfInstances, other.getNumberOfInstances())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VduDeltaImpl otherImpl = (VduDeltaImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VduDelta"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_numberOfInstances", _numberOfInstances); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VduDeltaKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VduDeltaKey.java new file mode 100644 index 0000000000000000000000000000000000000000..6d40bcee2ea2cff8ac43e4c882edb3cc0161442a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VduDeltaKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VduDeltaKey + implements Identifier { + private static final long serialVersionUID = -914817658662368518L; + private final String _id; + + + public VduDeltaKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VduDeltaKey(VduDeltaKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VduDeltaKey)) { + return false; + } + final VduDeltaKey other = (VduDeltaKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VduDeltaKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VirtualLinkBitRateDelta.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VirtualLinkBitRateDelta.java new file mode 100644 index 0000000000000000000000000000000000000000..0a3ea08a929d56cdab83dabb66a0b2005475f61b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VirtualLinkBitRateDelta.java @@ -0,0 +1,85 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.Deltas; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.virtual.link.bit.rate.delta.BitRateRequirements; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The bitrate to be added or removed to virtual links created from particular + * virtual link descriptors. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list virtual-link-bit-rate-delta {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   container bit-rate-requirements {
+ *     leaf root {
+ *       type uint32;
+ *       units bits/sec;
+ *     }
+ *     leaf leaf {
+ *       type uint32;
+ *       units bits/sec;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/scaling-aspect/aspect-delta-details/deltas/virtual-link-bit-rate-delta + * + *

To create instances of this class use {@link VirtualLinkBitRateDeltaBuilder}. + * @see VirtualLinkBitRateDeltaBuilder + * @see VirtualLinkBitRateDeltaKey + * + */ +public interface VirtualLinkBitRateDelta + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-link-bit-rate-delta"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.VirtualLinkBitRateDelta.class; + } + + /** + * Uniquely identifies a VnfVirtualLinkDesc. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * Bitrate requirements for an instantiation level or bitrate delta for a scaling + * step. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.virtual.link.bit.rate.delta.BitRateRequirements bitRateRequirements, or null if not present + */ + @Nullable BitRateRequirements getBitRateRequirements(); + + @Override + VirtualLinkBitRateDeltaKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VirtualLinkBitRateDeltaBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VirtualLinkBitRateDeltaBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..e76f4f3d7a79f9ea281208587898da460f423fa8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VirtualLinkBitRateDeltaBuilder.java @@ -0,0 +1,272 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.virtual.link.bit.rate.delta.BitRateRequirements; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualLinkBitRateDeltaBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkBitRateDeltaBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkBitRateDeltaBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkBitRateDeltaBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkBitRateDeltaBuilder + * @see Builder + * + */ +public class VirtualLinkBitRateDeltaBuilder implements Builder { + + private BitRateRequirements _bitRateRequirements; + private String _id; + private VirtualLinkBitRateDeltaKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualLinkBitRateDeltaBuilder() { + } + + public VirtualLinkBitRateDeltaBuilder(VirtualLinkBitRateDelta base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._bitRateRequirements = base.getBitRateRequirements(); + } + + + public VirtualLinkBitRateDeltaKey key() { + return key; + } + + public BitRateRequirements getBitRateRequirements() { + return _bitRateRequirements; + } + + public String getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VirtualLinkBitRateDeltaBuilder withKey(final VirtualLinkBitRateDeltaKey key) { + this.key = key; + return this; + } + + public VirtualLinkBitRateDeltaBuilder setBitRateRequirements(final BitRateRequirements value) { + this._bitRateRequirements = value; + return this; + } + + public VirtualLinkBitRateDeltaBuilder setId(final String value) { + this._id = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualLinkBitRateDeltaBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkBitRateDeltaBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualLinkBitRateDeltaBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualLinkBitRateDeltaBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualLinkBitRateDelta build() { + return new VirtualLinkBitRateDeltaImpl(this); + } + + private static final class VirtualLinkBitRateDeltaImpl + extends AbstractAugmentable + implements VirtualLinkBitRateDelta { + + private final BitRateRequirements _bitRateRequirements; + private final String _id; + private final VirtualLinkBitRateDeltaKey key; + + VirtualLinkBitRateDeltaImpl(VirtualLinkBitRateDeltaBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VirtualLinkBitRateDeltaKey(base.getId()); + } + this._id = key.getId(); + this._bitRateRequirements = base.getBitRateRequirements(); + } + + @Override + public VirtualLinkBitRateDeltaKey key() { + return key; + } + + @Override + public BitRateRequirements getBitRateRequirements() { + return _bitRateRequirements; + } + + @Override + public String getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_bitRateRequirements); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkBitRateDelta.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkBitRateDelta other = (VirtualLinkBitRateDelta)obj; + if (!Objects.equals(_bitRateRequirements, other.getBitRateRequirements())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualLinkBitRateDeltaImpl otherImpl = (VirtualLinkBitRateDeltaImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkBitRateDelta"); + CodeHelpers.appendValue(helper, "_bitRateRequirements", _bitRateRequirements); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VirtualLinkBitRateDeltaKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VirtualLinkBitRateDeltaKey.java new file mode 100644 index 0000000000000000000000000000000000000000..34000dc063eea50b6837e3d4699ad9bb6debdb6f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/VirtualLinkBitRateDeltaKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VirtualLinkBitRateDeltaKey + implements Identifier { + private static final long serialVersionUID = 1534832672872143650L; + private final String _id; + + + public VirtualLinkBitRateDeltaKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VirtualLinkBitRateDeltaKey(VirtualLinkBitRateDeltaKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VirtualLinkBitRateDeltaKey)) { + return false; + } + final VirtualLinkBitRateDeltaKey other = (VirtualLinkBitRateDeltaKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VirtualLinkBitRateDeltaKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/virtual/link/bit/rate/delta/BitRateRequirements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/virtual/link/bit/rate/delta/BitRateRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..dbe14dd55e6878517bb28af1d71cd4439ccd3e3c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/virtual/link/bit/rate/delta/BitRateRequirements.java @@ -0,0 +1,73 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.virtual.link.bit.rate.delta; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.VirtualLinkBitRateDelta; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Bitrate requirements for an instantiation level or bitrate delta for a scaling + * step. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container bit-rate-requirements {
+ *   leaf root {
+ *     type uint32;
+ *     units bits/sec;
+ *   }
+ *   leaf leaf {
+ *     type uint32;
+ *     units bits/sec;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/scaling-aspect/aspect-delta-details/deltas/virtual-link-bit-rate-delta/bit-rate-requirements + * + *

To create instances of this class use {@link BitRateRequirementsBuilder}. + * @see BitRateRequirementsBuilder + * + */ +public interface BitRateRequirements + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("bit-rate-requirements"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.virtual.link.bit.rate.delta.BitRateRequirements.class; + } + + /** + * Throughput requirement of the link (e.g. bitrate of E-Line, root bitrate of + * E-Tree, aggregate capacity of E-LAN). + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 root, or null if not present + */ + @Nullable Uint32 getRoot(); + + /** + * Throughput requirement of leaf connections to the link when applicable to the + * connectivity type (e.g. for E-Tree and E-LAN branches). + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 leaf, or null if not present + */ + @Nullable Uint32 getLeaf(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/virtual/link/bit/rate/delta/BitRateRequirementsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/virtual/link/bit/rate/delta/BitRateRequirementsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..dd8e11ef4ea54427a0e4428ab1d477ccadff9b8b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/scaling/aspect/aspect/delta/details/deltas/virtual/link/bit/rate/delta/BitRateRequirementsBuilder.java @@ -0,0 +1,276 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.scaling.aspect.aspect.delta.details.deltas.virtual.link.bit.rate.delta; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link BitRateRequirementsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     BitRateRequirementsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new BitRateRequirementsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of BitRateRequirementsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see BitRateRequirementsBuilder + * @see Builder + * + */ +public class BitRateRequirementsBuilder implements Builder { + + private Uint32 _leaf; + private Uint32 _root; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public BitRateRequirementsBuilder() { + } + + public BitRateRequirementsBuilder(BitRateRequirements base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + + public Uint32 getLeaf() { + return _leaf; + } + + public Uint32 getRoot() { + return _root; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public BitRateRequirementsBuilder setLeaf(final Uint32 value) { + this._leaf = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLeaf(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public BitRateRequirementsBuilder setLeaf(final Long value) { + return setLeaf(CodeHelpers.compatUint(value)); + } + + public BitRateRequirementsBuilder setRoot(final Uint32 value) { + this._root = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setRoot(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public BitRateRequirementsBuilder setRoot(final Long value) { + return setRoot(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public BitRateRequirementsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public BitRateRequirementsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public BitRateRequirementsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private BitRateRequirementsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public BitRateRequirements build() { + return new BitRateRequirementsImpl(this); + } + + private static final class BitRateRequirementsImpl + extends AbstractAugmentable + implements BitRateRequirements { + + private final Uint32 _leaf; + private final Uint32 _root; + + BitRateRequirementsImpl(BitRateRequirementsBuilder base) { + super(base.augmentation); + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + @Override + public Uint32 getLeaf() { + return _leaf; + } + + @Override + public Uint32 getRoot() { + return _root; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_leaf); + result = prime * result + Objects.hashCode(_root); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!BitRateRequirements.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + BitRateRequirements other = (BitRateRequirements)obj; + if (!Objects.equals(_leaf, other.getLeaf())) { + return false; + } + if (!Objects.equals(_root, other.getRoot())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + BitRateRequirementsImpl otherImpl = (BitRateRequirementsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("BitRateRequirements"); + CodeHelpers.appendValue(helper, "_leaf", _leaf); + CodeHelpers.appendValue(helper, "_root", _root); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/supported/vnf/interfaces/InterfaceDetails.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/supported/vnf/interfaces/InterfaceDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..e26ada49f14e9b4c9e4399c61896e8b614c63f74 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/supported/vnf/interfaces/InterfaceDetails.java @@ -0,0 +1,66 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.supported.vnf.interfaces; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.SupportedVnfInterfaces; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list interface-details {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/supported-vnf-interfaces/interface-details + * + *

To create instances of this class use {@link InterfaceDetailsBuilder}. + * @see InterfaceDetailsBuilder + * @see InterfaceDetailsKey + * + */ +public interface InterfaceDetails + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("interface-details"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.supported.vnf.interfaces.InterfaceDetails.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + InterfaceDetailsKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/supported/vnf/interfaces/InterfaceDetailsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/supported/vnf/interfaces/InterfaceDetailsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..422f5b9dd5d97eec69fa5e8f58c7ae7d4079cb1c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/supported/vnf/interfaces/InterfaceDetailsBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.supported.vnf.interfaces; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link InterfaceDetailsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     InterfaceDetailsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new InterfaceDetailsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of InterfaceDetailsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see InterfaceDetailsBuilder + * @see Builder + * + */ +public class InterfaceDetailsBuilder implements Builder { + + private String _key; + private String _value; + private InterfaceDetailsKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public InterfaceDetailsBuilder() { + } + + public InterfaceDetailsBuilder(InterfaceDetails base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public InterfaceDetailsKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public InterfaceDetailsBuilder withKey(final InterfaceDetailsKey key) { + this.key = key; + return this; + } + + public InterfaceDetailsBuilder setKey(final String value) { + this._key = value; + return this; + } + + public InterfaceDetailsBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public InterfaceDetailsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public InterfaceDetailsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public InterfaceDetailsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private InterfaceDetailsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public InterfaceDetails build() { + return new InterfaceDetailsImpl(this); + } + + private static final class InterfaceDetailsImpl + extends AbstractAugmentable + implements InterfaceDetails { + + private final String _key; + private final String _value; + private final InterfaceDetailsKey key; + + InterfaceDetailsImpl(InterfaceDetailsBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new InterfaceDetailsKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public InterfaceDetailsKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!InterfaceDetails.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + InterfaceDetails other = (InterfaceDetails)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + InterfaceDetailsImpl otherImpl = (InterfaceDetailsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("InterfaceDetails"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/supported/vnf/interfaces/InterfaceDetailsKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/supported/vnf/interfaces/InterfaceDetailsKey.java new file mode 100644 index 0000000000000000000000000000000000000000..bd839a594f9eff1379df58478d0b6f049441dc18 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/supported/vnf/interfaces/InterfaceDetailsKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.supported.vnf.interfaces; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class InterfaceDetailsKey + implements Identifier { + private static final long serialVersionUID = -5048181238924750706L; + private final String _key; + + + public InterfaceDetailsKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public InterfaceDetailsKey(InterfaceDetailsKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof InterfaceDetailsKey)) { + return false; + } + final InterfaceDetailsKey other = (InterfaceDetailsKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(InterfaceDetailsKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/vdu/profile/AffinityOrAntiAffinityGroup.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/vdu/profile/AffinityOrAntiAffinityGroup.java new file mode 100644 index 0000000000000000000000000000000000000000..160a5b312be9f2fe8d6495bb2abff772083075f5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/vdu/profile/AffinityOrAntiAffinityGroup.java @@ -0,0 +1,66 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.vdu.profile; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VduProfile; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Identifier(s) of the affinity or anti-affinity group(s) the VDU belongs to. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list affinity-or-anti-affinity-group {
+ *   key id;
+ *   leaf id {
+ *     type leafref {
+ *       path ../../../affinity-or-anti-affinity-group/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/vdu-profile/affinity-or-anti-affinity-group + * + *

To create instances of this class use {@link AffinityOrAntiAffinityGroupBuilder}. + * @see AffinityOrAntiAffinityGroupBuilder + * @see AffinityOrAntiAffinityGroupKey + * + */ +public interface AffinityOrAntiAffinityGroup + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("affinity-or-anti-affinity-group"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.vdu.profile.AffinityOrAntiAffinityGroup.class; + } + + /** + * Identifies an affinity or anti-affinity group to which the affinity or + * anti-affinity rule applies. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + @Override + AffinityOrAntiAffinityGroupKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/vdu/profile/AffinityOrAntiAffinityGroupBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/vdu/profile/AffinityOrAntiAffinityGroupBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..c876163f1080c0b6010946891682f84f8f50d530 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/vdu/profile/AffinityOrAntiAffinityGroupBuilder.java @@ -0,0 +1,248 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.vdu.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link AffinityOrAntiAffinityGroupBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AffinityOrAntiAffinityGroupBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AffinityOrAntiAffinityGroupBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AffinityOrAntiAffinityGroupBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AffinityOrAntiAffinityGroupBuilder + * @see Builder + * + */ +public class AffinityOrAntiAffinityGroupBuilder implements Builder { + + private String _id; + private AffinityOrAntiAffinityGroupKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AffinityOrAntiAffinityGroupBuilder() { + } + + public AffinityOrAntiAffinityGroupBuilder(AffinityOrAntiAffinityGroup base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + } + + + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + public String getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AffinityOrAntiAffinityGroupBuilder withKey(final AffinityOrAntiAffinityGroupKey key) { + this.key = key; + return this; + } + + public AffinityOrAntiAffinityGroupBuilder setId(final String value) { + this._id = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AffinityOrAntiAffinityGroupBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AffinityOrAntiAffinityGroupBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public AffinityOrAntiAffinityGroup build() { + return new AffinityOrAntiAffinityGroupImpl(this); + } + + private static final class AffinityOrAntiAffinityGroupImpl + extends AbstractAugmentable + implements AffinityOrAntiAffinityGroup { + + private final String _id; + private final AffinityOrAntiAffinityGroupKey key; + + AffinityOrAntiAffinityGroupImpl(AffinityOrAntiAffinityGroupBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new AffinityOrAntiAffinityGroupKey(base.getId()); + } + this._id = key.getId(); + } + + @Override + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!AffinityOrAntiAffinityGroup.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + AffinityOrAntiAffinityGroup other = (AffinityOrAntiAffinityGroup)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AffinityOrAntiAffinityGroupImpl otherImpl = (AffinityOrAntiAffinityGroupImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("AffinityOrAntiAffinityGroup"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/vdu/profile/AffinityOrAntiAffinityGroupKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/vdu/profile/AffinityOrAntiAffinityGroupKey.java new file mode 100644 index 0000000000000000000000000000000000000000..e1ec4b4cae66decb52474a43ce76f44d5c37f66c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/vdu/profile/AffinityOrAntiAffinityGroupKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.vdu.profile; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class AffinityOrAntiAffinityGroupKey + implements Identifier { + private static final long serialVersionUID = -4909084403753675647L; + private final String _id; + + + public AffinityOrAntiAffinityGroupKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public AffinityOrAntiAffinityGroupKey(AffinityOrAntiAffinityGroupKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof AffinityOrAntiAffinityGroupKey)) { + return false; + } + final AffinityOrAntiAffinityGroupKey other = (AffinityOrAntiAffinityGroupKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(AffinityOrAntiAffinityGroupKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/AffinityOrAntiAffinityGroup.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/AffinityOrAntiAffinityGroup.java new file mode 100644 index 0000000000000000000000000000000000000000..76b01574431279a737efe827ae2ff2670273e50c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/AffinityOrAntiAffinityGroup.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VirtualLinkProfile; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Identifier(s) of the affinity or anti-affinity group(s) the VnfVirtualLinkDesc + * belongs to. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list affinity-or-anti-affinity-group {
+ *   key id;
+ *   leaf id {
+ *     type leafref {
+ *       path ../../../affinity-or-anti-affinity-group/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/virtual-link-profile/affinity-or-anti-affinity-group + * + *

To create instances of this class use {@link AffinityOrAntiAffinityGroupBuilder}. + * @see AffinityOrAntiAffinityGroupBuilder + * @see AffinityOrAntiAffinityGroupKey + * + */ +public interface AffinityOrAntiAffinityGroup + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("affinity-or-anti-affinity-group"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.AffinityOrAntiAffinityGroup.class; + } + + /** + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + @Override + AffinityOrAntiAffinityGroupKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/AffinityOrAntiAffinityGroupBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/AffinityOrAntiAffinityGroupBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..1e3a2ed454f155b75c36258bdae236ca25d22431 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/AffinityOrAntiAffinityGroupBuilder.java @@ -0,0 +1,248 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link AffinityOrAntiAffinityGroupBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AffinityOrAntiAffinityGroupBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AffinityOrAntiAffinityGroupBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AffinityOrAntiAffinityGroupBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AffinityOrAntiAffinityGroupBuilder + * @see Builder + * + */ +public class AffinityOrAntiAffinityGroupBuilder implements Builder { + + private String _id; + private AffinityOrAntiAffinityGroupKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AffinityOrAntiAffinityGroupBuilder() { + } + + public AffinityOrAntiAffinityGroupBuilder(AffinityOrAntiAffinityGroup base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + } + + + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + public String getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AffinityOrAntiAffinityGroupBuilder withKey(final AffinityOrAntiAffinityGroupKey key) { + this.key = key; + return this; + } + + public AffinityOrAntiAffinityGroupBuilder setId(final String value) { + this._id = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AffinityOrAntiAffinityGroupBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AffinityOrAntiAffinityGroupBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AffinityOrAntiAffinityGroupBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public AffinityOrAntiAffinityGroup build() { + return new AffinityOrAntiAffinityGroupImpl(this); + } + + private static final class AffinityOrAntiAffinityGroupImpl + extends AbstractAugmentable + implements AffinityOrAntiAffinityGroup { + + private final String _id; + private final AffinityOrAntiAffinityGroupKey key; + + AffinityOrAntiAffinityGroupImpl(AffinityOrAntiAffinityGroupBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new AffinityOrAntiAffinityGroupKey(base.getId()); + } + this._id = key.getId(); + } + + @Override + public AffinityOrAntiAffinityGroupKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!AffinityOrAntiAffinityGroup.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + AffinityOrAntiAffinityGroup other = (AffinityOrAntiAffinityGroup)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AffinityOrAntiAffinityGroupImpl otherImpl = (AffinityOrAntiAffinityGroupImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("AffinityOrAntiAffinityGroup"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/AffinityOrAntiAffinityGroupKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/AffinityOrAntiAffinityGroupKey.java new file mode 100644 index 0000000000000000000000000000000000000000..e15bb71a2b484562c91f767217b8f3de422cc839 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/AffinityOrAntiAffinityGroupKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class AffinityOrAntiAffinityGroupKey + implements Identifier { + private static final long serialVersionUID = -4909084403753675647L; + private final String _id; + + + public AffinityOrAntiAffinityGroupKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public AffinityOrAntiAffinityGroupKey(AffinityOrAntiAffinityGroupKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof AffinityOrAntiAffinityGroupKey)) { + return false; + } + final AffinityOrAntiAffinityGroupKey other = (AffinityOrAntiAffinityGroupKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(AffinityOrAntiAffinityGroupKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MaxBitRateRequirements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MaxBitRateRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..c53850d7b51d42b629acfe37d9e3aef204598376 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MaxBitRateRequirements.java @@ -0,0 +1,71 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VirtualLinkProfile; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Specifies the maximum bitrate requirements for a VL instantiated according to + * this profile. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container max-bit-rate-requirements {
+ *   leaf root {
+ *     type uint32;
+ *   }
+ *   leaf leaf {
+ *     type uint32;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/virtual-link-profile/max-bit-rate-requirements + * + *

To create instances of this class use {@link MaxBitRateRequirementsBuilder}. + * @see MaxBitRateRequirementsBuilder + * + */ +public interface MaxBitRateRequirements + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("max-bit-rate-requirements"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.MaxBitRateRequirements.class; + } + + /** + * Throughput requirement of the link (e.g. bitrate of E-Line, root bitrate of + * E-Tree, aggregate capacity of E-LAN). + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 root, or null if not present + */ + @Nullable Uint32 getRoot(); + + /** + * Throughput requirement of leaf connections to the link when applicable to the + * connectivity type (e.g. for E-Tree and E-LAN branches). + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 leaf, or null if not present + */ + @Nullable Uint32 getLeaf(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MaxBitRateRequirementsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MaxBitRateRequirementsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..59a7760e7933aef32ef008e7a1138f8ffaaa183c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MaxBitRateRequirementsBuilder.java @@ -0,0 +1,276 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link MaxBitRateRequirementsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     MaxBitRateRequirementsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new MaxBitRateRequirementsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of MaxBitRateRequirementsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see MaxBitRateRequirementsBuilder + * @see Builder + * + */ +public class MaxBitRateRequirementsBuilder implements Builder { + + private Uint32 _leaf; + private Uint32 _root; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public MaxBitRateRequirementsBuilder() { + } + + public MaxBitRateRequirementsBuilder(MaxBitRateRequirements base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + + public Uint32 getLeaf() { + return _leaf; + } + + public Uint32 getRoot() { + return _root; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public MaxBitRateRequirementsBuilder setLeaf(final Uint32 value) { + this._leaf = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLeaf(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public MaxBitRateRequirementsBuilder setLeaf(final Long value) { + return setLeaf(CodeHelpers.compatUint(value)); + } + + public MaxBitRateRequirementsBuilder setRoot(final Uint32 value) { + this._root = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setRoot(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public MaxBitRateRequirementsBuilder setRoot(final Long value) { + return setRoot(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public MaxBitRateRequirementsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public MaxBitRateRequirementsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public MaxBitRateRequirementsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private MaxBitRateRequirementsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public MaxBitRateRequirements build() { + return new MaxBitRateRequirementsImpl(this); + } + + private static final class MaxBitRateRequirementsImpl + extends AbstractAugmentable + implements MaxBitRateRequirements { + + private final Uint32 _leaf; + private final Uint32 _root; + + MaxBitRateRequirementsImpl(MaxBitRateRequirementsBuilder base) { + super(base.augmentation); + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + @Override + public Uint32 getLeaf() { + return _leaf; + } + + @Override + public Uint32 getRoot() { + return _root; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_leaf); + result = prime * result + Objects.hashCode(_root); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!MaxBitRateRequirements.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + MaxBitRateRequirements other = (MaxBitRateRequirements)obj; + if (!Objects.equals(_leaf, other.getLeaf())) { + return false; + } + if (!Objects.equals(_root, other.getRoot())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + MaxBitRateRequirementsImpl otherImpl = (MaxBitRateRequirementsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("MaxBitRateRequirements"); + CodeHelpers.appendValue(helper, "_leaf", _leaf); + CodeHelpers.appendValue(helper, "_root", _root); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MinBitRateRequirements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MinBitRateRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..02f1e0752442cc05677bd63534a79122980e8f2f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MinBitRateRequirements.java @@ -0,0 +1,71 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VirtualLinkProfile; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Specifies the minimum bitrate requirements for a VL instantiated according to + * this profile. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container min-bit-rate-requirements {
+ *   leaf root {
+ *     type uint32;
+ *   }
+ *   leaf leaf {
+ *     type uint32;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/virtual-link-profile/min-bit-rate-requirements + * + *

To create instances of this class use {@link MinBitRateRequirementsBuilder}. + * @see MinBitRateRequirementsBuilder + * + */ +public interface MinBitRateRequirements + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("min-bit-rate-requirements"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.MinBitRateRequirements.class; + } + + /** + * Throughput requirement of the link (e.g. bitrate of E-Line, root bitrate of + * E-Tree, aggregate capacity of E-LAN). + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 root, or null if not present + */ + @Nullable Uint32 getRoot(); + + /** + * Throughput requirement of leaf connections to the link when applicable to the + * connectivity type (e.g. for E-Tree and E-LAN branches). + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 leaf, or null if not present + */ + @Nullable Uint32 getLeaf(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MinBitRateRequirementsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MinBitRateRequirementsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..4d6a26d261032960a610fbf9a95e640b2e328927 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/MinBitRateRequirementsBuilder.java @@ -0,0 +1,276 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link MinBitRateRequirementsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     MinBitRateRequirementsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new MinBitRateRequirementsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of MinBitRateRequirementsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see MinBitRateRequirementsBuilder + * @see Builder + * + */ +public class MinBitRateRequirementsBuilder implements Builder { + + private Uint32 _leaf; + private Uint32 _root; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public MinBitRateRequirementsBuilder() { + } + + public MinBitRateRequirementsBuilder(MinBitRateRequirements base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + + public Uint32 getLeaf() { + return _leaf; + } + + public Uint32 getRoot() { + return _root; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public MinBitRateRequirementsBuilder setLeaf(final Uint32 value) { + this._leaf = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLeaf(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public MinBitRateRequirementsBuilder setLeaf(final Long value) { + return setLeaf(CodeHelpers.compatUint(value)); + } + + public MinBitRateRequirementsBuilder setRoot(final Uint32 value) { + this._root = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setRoot(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public MinBitRateRequirementsBuilder setRoot(final Long value) { + return setRoot(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public MinBitRateRequirementsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public MinBitRateRequirementsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public MinBitRateRequirementsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private MinBitRateRequirementsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public MinBitRateRequirements build() { + return new MinBitRateRequirementsImpl(this); + } + + private static final class MinBitRateRequirementsImpl + extends AbstractAugmentable + implements MinBitRateRequirements { + + private final Uint32 _leaf; + private final Uint32 _root; + + MinBitRateRequirementsImpl(MinBitRateRequirementsBuilder base) { + super(base.augmentation); + this._leaf = base.getLeaf(); + this._root = base.getRoot(); + } + + @Override + public Uint32 getLeaf() { + return _leaf; + } + + @Override + public Uint32 getRoot() { + return _root; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_leaf); + result = prime * result + Objects.hashCode(_root); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!MinBitRateRequirements.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + MinBitRateRequirements other = (MinBitRateRequirements)obj; + if (!Objects.equals(_leaf, other.getLeaf())) { + return false; + } + if (!Objects.equals(_root, other.getRoot())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + MinBitRateRequirementsImpl otherImpl = (MinBitRateRequirementsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("MinBitRateRequirements"); + CodeHelpers.appendValue(helper, "_leaf", _leaf); + CodeHelpers.appendValue(helper, "_root", _root); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/VirtualLinkProtocolData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/VirtualLinkProtocolData.java new file mode 100644 index 0000000000000000000000000000000000000000..579c118465732f25149fcc27edc4fbeb499a9a09 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/VirtualLinkProtocolData.java @@ -0,0 +1,137 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.VirtualLinkProfile; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L2ProtocolData; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L3ProtocolData; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies the protocol data for a VL instantiated according to this profile. + * Cardinality 0 is used when no protocol data needs to be specified. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container virtual-link-protocol-data {
+ *   leaf associated-layer-protocol {
+ *     type identityref {
+ *       base layer-protocol;
+ *     }
+ *   }
+ *   container l2-protocol-data {
+ *     when "(../associated-layer-protocol = 'Ethernet') or (../associated-layer-protocol = 'MPLS') or (../associated-layer-protocol = 'ODU2') or (../associated-layer-protocol = 'Pseudo-Wire')";
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf network-type {
+ *       type enumeration {
+ *         enum flat;
+ *         enum vlan;
+ *         enum vxlan;
+ *         enum gre;
+ *       }
+ *     }
+ *     leaf vlan-transparent {
+ *       type boolean;
+ *     }
+ *     leaf mtu {
+ *       type uint16;
+ *     }
+ *   }
+ *   container l3-protocol-data {
+ *     when "(../associated-layer-protocol = 'IPv4') or (../associated-layer-protocol = 'IPv6')";
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf ip-version {
+ *       type enumeration {
+ *         enum ipv4;
+ *         enum ipv6;
+ *       }
+ *       default ipv4;
+ *     }
+ *     leaf cidr {
+ *       type string;
+ *     }
+ *     leaf-list ip-allocation-pools {
+ *       type string;
+ *     }
+ *     leaf gateway-ip {
+ *       type inet:ip-address;
+ *     }
+ *     leaf dhcp-enabled {
+ *       type boolean;
+ *       default true;
+ *     }
+ *     leaf ipv6-address-mode {
+ *       when "../ip-version = 'ipv6'";
+ *       type enumeration {
+ *         enum slaac;
+ *         enum dhcpv6-stateful;
+ *         enum dhcpv6-stateless;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/virtual-link-profile/virtual-link-protocol-data + * + *

To create instances of this class use {@link VirtualLinkProtocolDataBuilder}. + * @see VirtualLinkProtocolDataBuilder + * + */ +public interface VirtualLinkProtocolData + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-link-protocol-data"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.VirtualLinkProtocolData.class; + } + + /** + * One of the values of the attribute layerProtocol of the ConnectivityType IE. + * + * + * + * @return java.lang.Class associatedLayerProtocol, or null if not present + */ + @Nullable Class getAssociatedLayerProtocol(); + + /** + * Specifies the L2 protocol data for this virtual link. Shall be present when the + * associatedLayerProtocol attribute indicates a L2 protocol and shall be absent + * otherwise. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L2ProtocolData l2ProtocolData, or null if not present + */ + @Nullable L2ProtocolData getL2ProtocolData(); + + /** + * Specifies the L3 protocol data for this virtual link. Shall be present when the + * associatedLayerProtocol attribute indicates a L3 protocol and shall be absent + * otherwise. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L3ProtocolData l3ProtocolData, or null if not present + */ + @Nullable L3ProtocolData getL3ProtocolData(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/VirtualLinkProtocolDataBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/VirtualLinkProtocolDataBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..8114a62170a21198919f6df0defa193ce7598521 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/VirtualLinkProtocolDataBuilder.java @@ -0,0 +1,276 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L2ProtocolData; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L3ProtocolData; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualLinkProtocolDataBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkProtocolDataBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkProtocolDataBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkProtocolDataBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkProtocolDataBuilder + * @see Builder + * + */ +public class VirtualLinkProtocolDataBuilder implements Builder { + + private Class _associatedLayerProtocol; + private L2ProtocolData _l2ProtocolData; + private L3ProtocolData _l3ProtocolData; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualLinkProtocolDataBuilder() { + } + + public VirtualLinkProtocolDataBuilder(VirtualLinkProtocolData base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._associatedLayerProtocol = base.getAssociatedLayerProtocol(); + this._l2ProtocolData = base.getL2ProtocolData(); + this._l3ProtocolData = base.getL3ProtocolData(); + } + + + public Class getAssociatedLayerProtocol() { + return _associatedLayerProtocol; + } + + public L2ProtocolData getL2ProtocolData() { + return _l2ProtocolData; + } + + public L3ProtocolData getL3ProtocolData() { + return _l3ProtocolData; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VirtualLinkProtocolDataBuilder setAssociatedLayerProtocol(final Class value) { + this._associatedLayerProtocol = value; + return this; + } + + public VirtualLinkProtocolDataBuilder setL2ProtocolData(final L2ProtocolData value) { + this._l2ProtocolData = value; + return this; + } + + public VirtualLinkProtocolDataBuilder setL3ProtocolData(final L3ProtocolData value) { + this._l3ProtocolData = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualLinkProtocolDataBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkProtocolDataBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualLinkProtocolDataBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualLinkProtocolDataBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualLinkProtocolData build() { + return new VirtualLinkProtocolDataImpl(this); + } + + private static final class VirtualLinkProtocolDataImpl + extends AbstractAugmentable + implements VirtualLinkProtocolData { + + private final Class _associatedLayerProtocol; + private final L2ProtocolData _l2ProtocolData; + private final L3ProtocolData _l3ProtocolData; + + VirtualLinkProtocolDataImpl(VirtualLinkProtocolDataBuilder base) { + super(base.augmentation); + this._associatedLayerProtocol = base.getAssociatedLayerProtocol(); + this._l2ProtocolData = base.getL2ProtocolData(); + this._l3ProtocolData = base.getL3ProtocolData(); + } + + @Override + public Class getAssociatedLayerProtocol() { + return _associatedLayerProtocol; + } + + @Override + public L2ProtocolData getL2ProtocolData() { + return _l2ProtocolData; + } + + @Override + public L3ProtocolData getL3ProtocolData() { + return _l3ProtocolData; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_associatedLayerProtocol); + result = prime * result + Objects.hashCode(_l2ProtocolData); + result = prime * result + Objects.hashCode(_l3ProtocolData); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkProtocolData.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkProtocolData other = (VirtualLinkProtocolData)obj; + if (!Objects.equals(_associatedLayerProtocol, other.getAssociatedLayerProtocol())) { + return false; + } + if (!Objects.equals(_l2ProtocolData, other.getL2ProtocolData())) { + return false; + } + if (!Objects.equals(_l3ProtocolData, other.getL3ProtocolData())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualLinkProtocolDataImpl otherImpl = (VirtualLinkProtocolDataImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkProtocolData"); + CodeHelpers.appendValue(helper, "_associatedLayerProtocol", _associatedLayerProtocol); + CodeHelpers.appendValue(helper, "_l2ProtocolData", _l2ProtocolData); + CodeHelpers.appendValue(helper, "_l3ProtocolData", _l3ProtocolData); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L2ProtocolData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L2ProtocolData.java new file mode 100644 index 0000000000000000000000000000000000000000..31624077a13780c3f1a984746a9cdce5ff89ac50 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L2ProtocolData.java @@ -0,0 +1,174 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.VirtualLinkProtocolData; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Specifies the L2 protocol data for this virtual link. Shall be present when the + * associatedLayerProtocol attribute indicates a L2 protocol and shall be absent + * otherwise. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container l2-protocol-data {
+ *   when "(../associated-layer-protocol = 'Ethernet') or (../associated-layer-protocol = 'MPLS') or (../associated-layer-protocol = 'ODU2') or (../associated-layer-protocol = 'Pseudo-Wire')";
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf network-type {
+ *     type enumeration {
+ *       enum flat;
+ *       enum vlan;
+ *       enum vxlan;
+ *       enum gre;
+ *     }
+ *   }
+ *   leaf vlan-transparent {
+ *     type boolean;
+ *   }
+ *   leaf mtu {
+ *     type uint16;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/virtual-link-profile/virtual-link-protocol-data/l2-protocol-data + * + *

To create instances of this class use {@link L2ProtocolDataBuilder}. + * @see L2ProtocolDataBuilder + * + */ +public interface L2ProtocolData + extends + ChildOf, + Augmentable +{ + + + public enum NetworkType implements Enumeration { + Flat(0, "flat"), + + Vlan(1, "vlan"), + + Vxlan(2, "vxlan"), + + Gre(3, "gre") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (NetworkType enumItem : NetworkType.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private NetworkType(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding NetworkType item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding NetworkType item, or null if no such item exists + */ + public static NetworkType forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("l2-protocol-data"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L2ProtocolData.class; + } + + /** + * Network name associated with this L2 protocol. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Specifies the network type for this L2 protocol. Possible values: FLAT, VLAN, + * VXLAN, GRE. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L2ProtocolData.NetworkType networkType, or null if not present + */ + @Nullable NetworkType getNetworkType(); + + /** + * Specifies whether to support VLAN transparency for this L2 protocol or not. + * + * + * + * @return java.lang.Boolean vlanTransparent, or null if not present + */ + @Nullable Boolean isVlanTransparent(); + + /** + * Specifies the maximum transmission unit (MTU) value for this L2 protocol. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 mtu, or null if not present + */ + @Nullable Uint16 getMtu(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L2ProtocolDataBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L2ProtocolDataBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..a66a755af2b26f8832b37a3749e0bf56dfbcd100 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L2ProtocolDataBuilder.java @@ -0,0 +1,311 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Integer; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Class that builds {@link L2ProtocolDataBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     L2ProtocolDataBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new L2ProtocolDataBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of L2ProtocolDataBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see L2ProtocolDataBuilder + * @see Builder + * + */ +public class L2ProtocolDataBuilder implements Builder { + + private Uint16 _mtu; + private String _name; + private L2ProtocolData.NetworkType _networkType; + private Boolean _vlanTransparent; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public L2ProtocolDataBuilder() { + } + + public L2ProtocolDataBuilder(L2ProtocolData base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._mtu = base.getMtu(); + this._name = base.getName(); + this._networkType = base.getNetworkType(); + this._vlanTransparent = base.isVlanTransparent(); + } + + + public Uint16 getMtu() { + return _mtu; + } + + public String getName() { + return _name; + } + + public L2ProtocolData.NetworkType getNetworkType() { + return _networkType; + } + + public Boolean isVlanTransparent() { + return _vlanTransparent; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public L2ProtocolDataBuilder setMtu(final Uint16 value) { + this._mtu = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setMtu(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public L2ProtocolDataBuilder setMtu(final Integer value) { + return setMtu(CodeHelpers.compatUint(value)); + } + + public L2ProtocolDataBuilder setName(final String value) { + this._name = value; + return this; + } + + public L2ProtocolDataBuilder setNetworkType(final L2ProtocolData.NetworkType value) { + this._networkType = value; + return this; + } + + public L2ProtocolDataBuilder setVlanTransparent(final Boolean value) { + this._vlanTransparent = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public L2ProtocolDataBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public L2ProtocolDataBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public L2ProtocolDataBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private L2ProtocolDataBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public L2ProtocolData build() { + return new L2ProtocolDataImpl(this); + } + + private static final class L2ProtocolDataImpl + extends AbstractAugmentable + implements L2ProtocolData { + + private final Uint16 _mtu; + private final String _name; + private final L2ProtocolData.NetworkType _networkType; + private final Boolean _vlanTransparent; + + L2ProtocolDataImpl(L2ProtocolDataBuilder base) { + super(base.augmentation); + this._mtu = base.getMtu(); + this._name = base.getName(); + this._networkType = base.getNetworkType(); + this._vlanTransparent = base.isVlanTransparent(); + } + + @Override + public Uint16 getMtu() { + return _mtu; + } + + @Override + public String getName() { + return _name; + } + + @Override + public L2ProtocolData.NetworkType getNetworkType() { + return _networkType; + } + + @Override + public Boolean isVlanTransparent() { + return _vlanTransparent; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_mtu); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_networkType); + result = prime * result + Objects.hashCode(_vlanTransparent); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!L2ProtocolData.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + L2ProtocolData other = (L2ProtocolData)obj; + if (!Objects.equals(_mtu, other.getMtu())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_networkType, other.getNetworkType())) { + return false; + } + if (!Objects.equals(_vlanTransparent, other.isVlanTransparent())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + L2ProtocolDataImpl otherImpl = (L2ProtocolDataImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("L2ProtocolData"); + CodeHelpers.appendValue(helper, "_mtu", _mtu); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_networkType", _networkType); + CodeHelpers.appendValue(helper, "_vlanTransparent", _vlanTransparent); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L3ProtocolData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L3ProtocolData.java new file mode 100644 index 0000000000000000000000000000000000000000..d6947bed500280e78b30799eeb432abfa76dfdc6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L3ProtocolData.java @@ -0,0 +1,278 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.VirtualLinkProtocolData; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies the L3 protocol data for this virtual link. Shall be present when the + * associatedLayerProtocol attribute indicates a L3 protocol and shall be absent + * otherwise. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container l3-protocol-data {
+ *   when "(../associated-layer-protocol = 'IPv4') or (../associated-layer-protocol = 'IPv6')";
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf ip-version {
+ *     type enumeration {
+ *       enum ipv4;
+ *       enum ipv6;
+ *     }
+ *     default ipv4;
+ *   }
+ *   leaf cidr {
+ *     type string;
+ *   }
+ *   leaf-list ip-allocation-pools {
+ *     type string;
+ *   }
+ *   leaf gateway-ip {
+ *     type inet:ip-address;
+ *   }
+ *   leaf dhcp-enabled {
+ *     type boolean;
+ *     default true;
+ *   }
+ *   leaf ipv6-address-mode {
+ *     when "../ip-version = 'ipv6'";
+ *     type enumeration {
+ *       enum slaac;
+ *       enum dhcpv6-stateful;
+ *       enum dhcpv6-stateless;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/df/virtual-link-profile/virtual-link-protocol-data/l3-protocol-data + * + *

To create instances of this class use {@link L3ProtocolDataBuilder}. + * @see L3ProtocolDataBuilder + * + */ +public interface L3ProtocolData + extends + ChildOf, + Augmentable +{ + + + public enum IpVersion implements Enumeration { + Ipv4(0, "ipv4"), + + Ipv6(1, "ipv6") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (IpVersion enumItem : IpVersion.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private IpVersion(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding IpVersion item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding IpVersion item, or null if no such item exists + */ + public static IpVersion forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public enum Ipv6AddressMode implements Enumeration { + Slaac(0, "slaac"), + + Dhcpv6Stateful(1, "dhcpv6-stateful"), + + Dhcpv6Stateless(2, "dhcpv6-stateless") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (Ipv6AddressMode enumItem : Ipv6AddressMode.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private Ipv6AddressMode(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding Ipv6AddressMode item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding Ipv6AddressMode item, or null if no such item exists + */ + public static Ipv6AddressMode forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("l3-protocol-data"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L3ProtocolData.class; + } + + /** + * Network name associated with this L3 protocol. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Specifies IP version of this L3 protocol. Value: • IPV4. • IPV6. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L3ProtocolData.IpVersion ipVersion, or null if not present + */ + @Nullable IpVersion getIpVersion(); + + /** + * Specifies the CIDR (Classless InterDomain Routing) of this L3 protocol. + * + * + * + * @return java.lang.String cidr, or null if not present + */ + @Nullable String getCidr(); + + /** + * Specifies the allocation pools with start and end IP addresses for this L3 + * protocol. + * + * + * + * @return java.util.List ipAllocationPools, or null if not present + */ + @Nullable List getIpAllocationPools(); + + /** + * Specifies the gateway IP address for this L3 protocol. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress gatewayIp, or null if not present + */ + @Nullable IpAddress getGatewayIp(); + + /** + * Indicates whether DHCP (Dynamic Host Configuration Protocol) is enabled or + * disabled for this L3 protocol. + * + * + * + * @return java.lang.Boolean dhcpEnabled, or null if not present + */ + @Nullable Boolean isDhcpEnabled(); + + /** + * Specifies IPv6 address mode. Possible values: • SLAAC. • DHCPV6-STATEFUL. • + * DHCPV6-STATELESS. May be present when the value of the ipVersion attribute is + * 'IPV6' and shall be absent otherwise. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L3ProtocolData.Ipv6AddressMode ipv6AddressMode, or null if not present + */ + @Nullable Ipv6AddressMode getIpv6AddressMode(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L3ProtocolDataBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L3ProtocolDataBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..a09833cc96896b52aacde6742c6565853953b040 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/df/virtual/link/profile/virtual/link/protocol/data/L3ProtocolDataBuilder.java @@ -0,0 +1,368 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link L3ProtocolDataBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     L3ProtocolDataBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new L3ProtocolDataBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of L3ProtocolDataBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see L3ProtocolDataBuilder + * @see Builder + * + */ +public class L3ProtocolDataBuilder implements Builder { + + private String _cidr; + private IpAddress _gatewayIp; + private List _ipAllocationPools; + private L3ProtocolData.IpVersion _ipVersion; + private L3ProtocolData.Ipv6AddressMode _ipv6AddressMode; + private String _name; + private Boolean _dhcpEnabled; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public L3ProtocolDataBuilder() { + } + + public L3ProtocolDataBuilder(L3ProtocolData base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._cidr = base.getCidr(); + this._gatewayIp = base.getGatewayIp(); + this._ipAllocationPools = base.getIpAllocationPools(); + this._ipVersion = base.getIpVersion(); + this._ipv6AddressMode = base.getIpv6AddressMode(); + this._name = base.getName(); + this._dhcpEnabled = base.isDhcpEnabled(); + } + + + public String getCidr() { + return _cidr; + } + + public IpAddress getGatewayIp() { + return _gatewayIp; + } + + public List getIpAllocationPools() { + return _ipAllocationPools; + } + + public L3ProtocolData.IpVersion getIpVersion() { + return _ipVersion; + } + + public L3ProtocolData.Ipv6AddressMode getIpv6AddressMode() { + return _ipv6AddressMode; + } + + public String getName() { + return _name; + } + + public Boolean isDhcpEnabled() { + return _dhcpEnabled; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public L3ProtocolDataBuilder setCidr(final String value) { + this._cidr = value; + return this; + } + + public L3ProtocolDataBuilder setGatewayIp(final IpAddress value) { + this._gatewayIp = value; + return this; + } + public L3ProtocolDataBuilder setIpAllocationPools(final List values) { + this._ipAllocationPools = values; + return this; + } + + + public L3ProtocolDataBuilder setIpVersion(final L3ProtocolData.IpVersion value) { + this._ipVersion = value; + return this; + } + + public L3ProtocolDataBuilder setIpv6AddressMode(final L3ProtocolData.Ipv6AddressMode value) { + this._ipv6AddressMode = value; + return this; + } + + public L3ProtocolDataBuilder setName(final String value) { + this._name = value; + return this; + } + + public L3ProtocolDataBuilder setDhcpEnabled(final Boolean value) { + this._dhcpEnabled = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public L3ProtocolDataBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public L3ProtocolDataBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public L3ProtocolDataBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private L3ProtocolDataBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public L3ProtocolData build() { + return new L3ProtocolDataImpl(this); + } + + private static final class L3ProtocolDataImpl + extends AbstractAugmentable + implements L3ProtocolData { + + private final String _cidr; + private final IpAddress _gatewayIp; + private final List _ipAllocationPools; + private final L3ProtocolData.IpVersion _ipVersion; + private final L3ProtocolData.Ipv6AddressMode _ipv6AddressMode; + private final String _name; + private final Boolean _dhcpEnabled; + + L3ProtocolDataImpl(L3ProtocolDataBuilder base) { + super(base.augmentation); + this._cidr = base.getCidr(); + this._gatewayIp = base.getGatewayIp(); + this._ipAllocationPools = base.getIpAllocationPools(); + this._ipVersion = base.getIpVersion(); + this._ipv6AddressMode = base.getIpv6AddressMode(); + this._name = base.getName(); + this._dhcpEnabled = base.isDhcpEnabled(); + } + + @Override + public String getCidr() { + return _cidr; + } + + @Override + public IpAddress getGatewayIp() { + return _gatewayIp; + } + + @Override + public List getIpAllocationPools() { + return _ipAllocationPools; + } + + @Override + public L3ProtocolData.IpVersion getIpVersion() { + return _ipVersion; + } + + @Override + public L3ProtocolData.Ipv6AddressMode getIpv6AddressMode() { + return _ipv6AddressMode; + } + + @Override + public String getName() { + return _name; + } + + @Override + public Boolean isDhcpEnabled() { + return _dhcpEnabled; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cidr); + result = prime * result + Objects.hashCode(_gatewayIp); + result = prime * result + Objects.hashCode(_ipAllocationPools); + result = prime * result + Objects.hashCode(_ipVersion); + result = prime * result + Objects.hashCode(_ipv6AddressMode); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_dhcpEnabled); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!L3ProtocolData.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + L3ProtocolData other = (L3ProtocolData)obj; + if (!Objects.equals(_cidr, other.getCidr())) { + return false; + } + if (!Objects.equals(_gatewayIp, other.getGatewayIp())) { + return false; + } + if (!Objects.equals(_ipAllocationPools, other.getIpAllocationPools())) { + return false; + } + if (!Objects.equals(_ipVersion, other.getIpVersion())) { + return false; + } + if (!Objects.equals(_ipv6AddressMode, other.getIpv6AddressMode())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_dhcpEnabled, other.isDhcpEnabled())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + L3ProtocolDataImpl otherImpl = (L3ProtocolDataImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("L3ProtocolData"); + CodeHelpers.appendValue(helper, "_cidr", _cidr); + CodeHelpers.appendValue(helper, "_gatewayIp", _gatewayIp); + CodeHelpers.appendValue(helper, "_ipAllocationPools", _ipAllocationPools); + CodeHelpers.appendValue(helper, "_ipVersion", _ipVersion); + CodeHelpers.appendValue(helper, "_ipv6AddressMode", _ipv6AddressMode); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_dhcpEnabled", _dhcpEnabled); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/CpConnection.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/CpConnection.java new file mode 100644 index 0000000000000000000000000000000000000000..667a7d1896b87296e7b36fa6a95b657473409657 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/CpConnection.java @@ -0,0 +1,54 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ExtCpd; +import org.opendaylight.yangtools.yang.binding.ChoiceIn; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * choice cp-connection {
+ *   case int-virtual-link-desc {
+ *     leaf int-virtual-link-desc {
+ *       type leafref {
+ *         path ../../int-virtual-link-desc/id;
+ *       }
+ *     }
+ *   }
+ *   case int-cpd {
+ *     container int-cpd {
+ *       leaf vdu-id {
+ *         type leafref {
+ *           path ../../../vdu/id;
+ *         }
+ *       }
+ *       leaf cpd {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   case k8s-cluster-net {
+ *     leaf k8s-cluster-net {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/ext-cpd/cp-connection + * + */ +public interface CpConnection + extends + ChoiceIn +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("cp-connection"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntCpd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntCpd.java new file mode 100644 index 0000000000000000000000000000000000000000..30b35fbf04d68c48073f4a8e317bededa758b1c5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntCpd.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.CpConnection; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface IntCpd + extends + DataObject, + Augmentable, + CpConnection +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("int-cpd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection.IntCpd.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection._int.cpd.IntCpd intCpd, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection._int.cpd.@Nullable IntCpd getIntCpd(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntCpdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntCpdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..fc152c978912cc9f40759cf8a532898df6149811 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntCpdBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link IntCpdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     IntCpdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new IntCpdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of IntCpdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see IntCpdBuilder + * @see Builder + * + */ +public class IntCpdBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection._int.cpd.IntCpd _intCpd; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public IntCpdBuilder() { + } + + public IntCpdBuilder(IntCpd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._intCpd = base.getIntCpd(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection._int.cpd.IntCpd getIntCpd() { + return _intCpd; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public IntCpdBuilder setIntCpd(final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection._int.cpd.IntCpd value) { + this._intCpd = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public IntCpdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public IntCpdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public IntCpdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private IntCpdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public IntCpd build() { + return new IntCpdImpl(this); + } + + private static final class IntCpdImpl + extends AbstractAugmentable + implements IntCpd { + + private final org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection._int.cpd.IntCpd _intCpd; + + IntCpdImpl(IntCpdBuilder base) { + super(base.augmentation); + this._intCpd = base.getIntCpd(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection._int.cpd.IntCpd getIntCpd() { + return _intCpd; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_intCpd); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!IntCpd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + IntCpd other = (IntCpd)obj; + if (!Objects.equals(_intCpd, other.getIntCpd())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + IntCpdImpl otherImpl = (IntCpdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("IntCpd"); + CodeHelpers.appendValue(helper, "_intCpd", _intCpd); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntVirtualLinkDesc.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntVirtualLinkDesc.java new file mode 100644 index 0000000000000000000000000000000000000000..b99bcdb6a6c8621c9f8ca37dde445c068d6dc17a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntVirtualLinkDesc.java @@ -0,0 +1,41 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.CpConnection; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface IntVirtualLinkDesc + extends + DataObject, + Augmentable, + CpConnection +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("int-virtual-link-desc"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection.IntVirtualLinkDesc.class; + } + + /** + * Reference to the internal Virtual Link Descriptor (VLD) to which CPs + * instantiated from this external CP Descriptor (CPD) connect. Either + * intVirtualLinkDesc or intCpd shall be present. + * + * + * + * @return java.lang.String intVirtualLinkDesc, or null if not present + */ + @Nullable String getIntVirtualLinkDesc(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntVirtualLinkDescBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntVirtualLinkDescBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..8aa1723a3f7d8f32c4f6786c69cac04971f2fa77 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/IntVirtualLinkDescBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link IntVirtualLinkDescBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     IntVirtualLinkDescBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new IntVirtualLinkDescBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of IntVirtualLinkDescBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see IntVirtualLinkDescBuilder + * @see Builder + * + */ +public class IntVirtualLinkDescBuilder implements Builder { + + private String _intVirtualLinkDesc; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public IntVirtualLinkDescBuilder() { + } + + public IntVirtualLinkDescBuilder(IntVirtualLinkDesc base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._intVirtualLinkDesc = base.getIntVirtualLinkDesc(); + } + + + public String getIntVirtualLinkDesc() { + return _intVirtualLinkDesc; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public IntVirtualLinkDescBuilder setIntVirtualLinkDesc(final String value) { + this._intVirtualLinkDesc = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public IntVirtualLinkDescBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public IntVirtualLinkDescBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public IntVirtualLinkDescBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private IntVirtualLinkDescBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public IntVirtualLinkDesc build() { + return new IntVirtualLinkDescImpl(this); + } + + private static final class IntVirtualLinkDescImpl + extends AbstractAugmentable + implements IntVirtualLinkDesc { + + private final String _intVirtualLinkDesc; + + IntVirtualLinkDescImpl(IntVirtualLinkDescBuilder base) { + super(base.augmentation); + this._intVirtualLinkDesc = base.getIntVirtualLinkDesc(); + } + + @Override + public String getIntVirtualLinkDesc() { + return _intVirtualLinkDesc; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_intVirtualLinkDesc); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!IntVirtualLinkDesc.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + IntVirtualLinkDesc other = (IntVirtualLinkDesc)obj; + if (!Objects.equals(_intVirtualLinkDesc, other.getIntVirtualLinkDesc())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + IntVirtualLinkDescImpl otherImpl = (IntVirtualLinkDescImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("IntVirtualLinkDesc"); + CodeHelpers.appendValue(helper, "_intVirtualLinkDesc", _intVirtualLinkDesc); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/K8sClusterNet.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/K8sClusterNet.java new file mode 100644 index 0000000000000000000000000000000000000000..03717b46b67bc89b7d32fcba89e99dcd3b8573da --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/K8sClusterNet.java @@ -0,0 +1,40 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.CpConnection; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +public interface K8sClusterNet + extends + DataObject, + Augmentable, + CpConnection +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("k8s-cluster-net"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection.K8sClusterNet.class; + } + + /** + * Reference to the K8s cluster network to which CPs instantiated from this + * external CP Descriptor (CPD) connect. + * + * + * + * @return java.lang.String k8sClusterNet, or null if not present + */ + @Nullable String getK8sClusterNet(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/K8sClusterNetBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/K8sClusterNetBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..4a84d4f3418c43e6a8cca709b6a6da6471eafd8a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/K8sClusterNetBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link K8sClusterNetBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     K8sClusterNetBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new K8sClusterNetBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of K8sClusterNetBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see K8sClusterNetBuilder + * @see Builder + * + */ +public class K8sClusterNetBuilder implements Builder { + + private String _k8sClusterNet; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public K8sClusterNetBuilder() { + } + + public K8sClusterNetBuilder(K8sClusterNet base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._k8sClusterNet = base.getK8sClusterNet(); + } + + + public String getK8sClusterNet() { + return _k8sClusterNet; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public K8sClusterNetBuilder setK8sClusterNet(final String value) { + this._k8sClusterNet = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public K8sClusterNetBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public K8sClusterNetBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public K8sClusterNetBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private K8sClusterNetBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public K8sClusterNet build() { + return new K8sClusterNetImpl(this); + } + + private static final class K8sClusterNetImpl + extends AbstractAugmentable + implements K8sClusterNet { + + private final String _k8sClusterNet; + + K8sClusterNetImpl(K8sClusterNetBuilder base) { + super(base.augmentation); + this._k8sClusterNet = base.getK8sClusterNet(); + } + + @Override + public String getK8sClusterNet() { + return _k8sClusterNet; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_k8sClusterNet); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!K8sClusterNet.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + K8sClusterNet other = (K8sClusterNet)obj; + if (!Objects.equals(_k8sClusterNet, other.getK8sClusterNet())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + K8sClusterNetImpl otherImpl = (K8sClusterNetImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("K8sClusterNet"); + CodeHelpers.appendValue(helper, "_k8sClusterNet", _k8sClusterNet); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/_int/cpd/IntCpd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/_int/cpd/IntCpd.java new file mode 100644 index 0000000000000000000000000000000000000000..7efc59f9e9f40e8a9630495d460bfd6ca9db9ba6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/_int/cpd/IntCpd.java @@ -0,0 +1,61 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection._int.cpd; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ExtCpd; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container int-cpd {
+ *   leaf vdu-id {
+ *     type leafref {
+ *       path ../../../vdu/id;
+ *     }
+ *   }
+ *   leaf cpd {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/ext-cpd/cp-connection/int-cpd/int-cpd + * + *

To create instances of this class use {@link IntCpdBuilder}. + * @see IntCpdBuilder + * + */ +public interface IntCpd + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("int-cpd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection._int.cpd.IntCpd.class; + } + + /** + * @return java.lang.String vduId, or null if not present + */ + @Nullable String getVduId(); + + /** + * @return java.lang.String cpd, or null if not present + */ + @Nullable String getCpd(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/_int/cpd/IntCpdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/_int/cpd/IntCpdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..9e427ddac018aa42ae3472c0f9c0639449f85e54 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/ext/cpd/cp/connection/_int/cpd/IntCpdBuilder.java @@ -0,0 +1,250 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ext.cpd.cp.connection._int.cpd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link IntCpdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     IntCpdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new IntCpdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of IntCpdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see IntCpdBuilder + * @see Builder + * + */ +public class IntCpdBuilder implements Builder { + + private String _cpd; + private String _vduId; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public IntCpdBuilder() { + } + + public IntCpdBuilder(IntCpd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._cpd = base.getCpd(); + this._vduId = base.getVduId(); + } + + + public String getCpd() { + return _cpd; + } + + public String getVduId() { + return _vduId; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public IntCpdBuilder setCpd(final String value) { + this._cpd = value; + return this; + } + + public IntCpdBuilder setVduId(final String value) { + this._vduId = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public IntCpdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public IntCpdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public IntCpdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private IntCpdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public IntCpd build() { + return new IntCpdImpl(this); + } + + private static final class IntCpdImpl + extends AbstractAugmentable + implements IntCpd { + + private final String _cpd; + private final String _vduId; + + IntCpdImpl(IntCpdBuilder base) { + super(base.augmentation); + this._cpd = base.getCpd(); + this._vduId = base.getVduId(); + } + + @Override + public String getCpd() { + return _cpd; + } + + @Override + public String getVduId() { + return _vduId; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cpd); + result = prime * result + Objects.hashCode(_vduId); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!IntCpd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + IntCpd other = (IntCpd)obj; + if (!Objects.equals(_cpd, other.getCpd())) { + return false; + } + if (!Objects.equals(_vduId, other.getVduId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + IntCpdImpl otherImpl = (IntCpdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("IntCpd"); + CodeHelpers.appendValue(helper, "_cpd", _cpd); + CodeHelpers.appendValue(helper, "_vduId", _vduId); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/lifecycle/management/script/ScriptInput.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/lifecycle/management/script/ScriptInput.java new file mode 100644 index 0000000000000000000000000000000000000000..5fef55211702ff2ee63dfae5fe31b9aa58e2ce82 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/lifecycle/management/script/ScriptInput.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.lifecycle.management.script; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.LifecycleManagementScript; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of KVP requirements with the key as the parameter name and the value as + * the parameter that need to be passed as an input to the script. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list script-input {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/lifecycle-management-script/script-input + * + *

To create instances of this class use {@link ScriptInputBuilder}. + * @see ScriptInputBuilder + * @see ScriptInputKey + * + */ +public interface ScriptInput + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("script-input"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.lifecycle.management.script.ScriptInput.class; + } + + /** + * Includes a VNF LCM script (e.g. written in a DSL as specified in requirement + * VNF_PACK.LCM.001) triggered to react to one of the events listed in the event + * attribute. The string value specified here is a path to a file in the VNF + * package. + * + * + * + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + ScriptInputKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/lifecycle/management/script/ScriptInputBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/lifecycle/management/script/ScriptInputBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..8679002f3d3ebbaab8e0463346bf7b579ff51d83 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/lifecycle/management/script/ScriptInputBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.lifecycle.management.script; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ScriptInputBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ScriptInputBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ScriptInputBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ScriptInputBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ScriptInputBuilder + * @see Builder + * + */ +public class ScriptInputBuilder implements Builder { + + private String _key; + private String _value; + private ScriptInputKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ScriptInputBuilder() { + } + + public ScriptInputBuilder(ScriptInput base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public ScriptInputKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ScriptInputBuilder withKey(final ScriptInputKey key) { + this.key = key; + return this; + } + + public ScriptInputBuilder setKey(final String value) { + this._key = value; + return this; + } + + public ScriptInputBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ScriptInputBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ScriptInputBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ScriptInputBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ScriptInputBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ScriptInput build() { + return new ScriptInputImpl(this); + } + + private static final class ScriptInputImpl + extends AbstractAugmentable + implements ScriptInput { + + private final String _key; + private final String _value; + private final ScriptInputKey key; + + ScriptInputImpl(ScriptInputBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ScriptInputKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public ScriptInputKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ScriptInput.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ScriptInput other = (ScriptInput)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ScriptInputImpl otherImpl = (ScriptInputImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ScriptInput"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/lifecycle/management/script/ScriptInputKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/lifecycle/management/script/ScriptInputKey.java new file mode 100644 index 0000000000000000000000000000000000000000..f7b99ae6c21526b54187e8b8dd5415d0fa716e6a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/lifecycle/management/script/ScriptInputKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.lifecycle.management.script; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ScriptInputKey + implements Identifier { + private static final long serialVersionUID = 2999058324629710440L; + private final String _key; + + + public ScriptInputKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ScriptInputKey(ScriptInputKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ScriptInputKey)) { + return false; + } + final ScriptInputKey other = (ScriptInputKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ScriptInputKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/sw/image/desc/Checksum.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/sw/image/desc/Checksum.java new file mode 100644 index 0000000000000000000000000000000000000000..0f9b7fcb4a2284fae1366725ed2f90fd1ce73fea --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/sw/image/desc/Checksum.java @@ -0,0 +1,72 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.sw.image.desc; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ChecksumAlgorithm; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDesc; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The checksum of the software image file. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container checksum {
+ *   leaf algorithm {
+ *     type identityref {
+ *       base checksum-algorithm;
+ *     }
+ *   }
+ *   leaf hash {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/sw-image-desc/checksum + * + *

To create instances of this class use {@link ChecksumBuilder}. + * @see ChecksumBuilder + * + */ +public interface Checksum + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("checksum"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.sw.image.desc.Checksum.class; + } + + /** + * Species the algorithm used to obtain the checksum value. + * + * + * + * @return java.lang.Class algorithm, or null if not present + */ + @Nullable Class getAlgorithm(); + + /** + * Contains the result of applying the algorithm indicated by the algorithm + * attribute to the data to which this ChecksumData refers. + * + * + * + * @return java.lang.String hash, or null if not present + */ + @Nullable String getHash(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/sw/image/desc/ChecksumBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/sw/image/desc/ChecksumBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..5021c911c5524948102805641a9b082954601983 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/sw/image/desc/ChecksumBuilder.java @@ -0,0 +1,251 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.sw.image.desc; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.ChecksumAlgorithm; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ChecksumBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ChecksumBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ChecksumBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ChecksumBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ChecksumBuilder + * @see Builder + * + */ +public class ChecksumBuilder implements Builder { + + private Class _algorithm; + private String _hash; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ChecksumBuilder() { + } + + public ChecksumBuilder(Checksum base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._algorithm = base.getAlgorithm(); + this._hash = base.getHash(); + } + + + public Class getAlgorithm() { + return _algorithm; + } + + public String getHash() { + return _hash; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public ChecksumBuilder setAlgorithm(final Class value) { + this._algorithm = value; + return this; + } + + public ChecksumBuilder setHash(final String value) { + this._hash = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ChecksumBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ChecksumBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ChecksumBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ChecksumBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Checksum build() { + return new ChecksumImpl(this); + } + + private static final class ChecksumImpl + extends AbstractAugmentable + implements Checksum { + + private final Class _algorithm; + private final String _hash; + + ChecksumImpl(ChecksumBuilder base) { + super(base.augmentation); + this._algorithm = base.getAlgorithm(); + this._hash = base.getHash(); + } + + @Override + public Class getAlgorithm() { + return _algorithm; + } + + @Override + public String getHash() { + return _hash; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_algorithm); + result = prime * result + Objects.hashCode(_hash); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Checksum.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Checksum other = (Checksum)obj; + if (!Objects.equals(_algorithm, other.getAlgorithm())) { + return false; + } + if (!Objects.equals(_hash, other.getHash())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ChecksumImpl otherImpl = (ChecksumImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Checksum"); + CodeHelpers.appendValue(helper, "_algorithm", _algorithm); + CodeHelpers.appendValue(helper, "_hash", _hash); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/BootOrder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/BootOrder.java new file mode 100644 index 0000000000000000000000000000000000000000..0b94973c5122d315bff447cecaa8b10f30f93e2e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/BootOrder.java @@ -0,0 +1,74 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * The key indicates the boot index (lowest index defines highest boot priority). + * The Value references a descriptor from which a valid boot device is created + * VirtualStorageDesc from which a VirtualStorage instance is created. Editor's + * note: The boot-order node requires further study. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list boot-order {
+ *   ordered-by user;
+ *   key key;
+ *   leaf key {
+ *     type uint32;
+ *   }
+ *   leaf value {
+ *     type leafref {
+ *       path ../../virtual-storage-desc;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/vdu/boot-order + * + *

To create instances of this class use {@link BootOrderBuilder}. + * @see BootOrderBuilder + * @see BootOrderKey + * + */ +public interface BootOrder + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("boot-order"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.BootOrder.class; + } + + /** + * @return org.opendaylight.yangtools.yang.common.Uint32 key, or null if not present + */ + @Nullable Uint32 getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + BootOrderKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/BootOrderBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/BootOrderBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..98af37c91cd8243a71fcd3b208a4c011dac48e1b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/BootOrderBuilder.java @@ -0,0 +1,285 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link BootOrderBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     BootOrderBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new BootOrderBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of BootOrderBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see BootOrderBuilder + * @see Builder + * + */ +public class BootOrderBuilder implements Builder { + + private Uint32 _key; + private String _value; + private BootOrderKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public BootOrderBuilder() { + } + + public BootOrderBuilder(BootOrder base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public BootOrderKey key() { + return key; + } + + public Uint32 getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public BootOrderBuilder withKey(final BootOrderKey key) { + this.key = key; + return this; + } + + public BootOrderBuilder setKey(final Uint32 value) { + this._key = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setKey(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public BootOrderBuilder setKey(final Long value) { + return setKey(CodeHelpers.compatUint(value)); + } + + public BootOrderBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public BootOrderBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public BootOrderBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public BootOrderBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private BootOrderBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public BootOrder build() { + return new BootOrderImpl(this); + } + + private static final class BootOrderImpl + extends AbstractAugmentable + implements BootOrder { + + private final Uint32 _key; + private final String _value; + private final BootOrderKey key; + + BootOrderImpl(BootOrderBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new BootOrderKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public BootOrderKey key() { + return key; + } + + @Override + public Uint32 getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!BootOrder.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + BootOrder other = (BootOrder)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + BootOrderImpl otherImpl = (BootOrderImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("BootOrder"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/BootOrderKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/BootOrderKey.java new file mode 100644 index 0000000000000000000000000000000000000000..30e8978840d3ff8ef5b5071a4d6ca254f00519fb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/BootOrderKey.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import com.google.common.base.MoreObjects; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; +import org.opendaylight.yangtools.yang.common.Uint32; + +public class BootOrderKey + implements Identifier { + private static final long serialVersionUID = -3236633096323482894L; + private final Uint32 _key; + + + public BootOrderKey(Uint32 _key) { + + this._key = _key; + } + + /** + * Utility migration constructor. + * + * @param _key key in legacy Java type + * @deprecated Use {#link BootOrderKey(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public BootOrderKey(Long _key) { + this(CodeHelpers.compatUint(_key)); + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public BootOrderKey(BootOrderKey source) { + this._key = source._key; + } + + + public Uint32 getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof BootOrderKey)) { + return false; + } + final BootOrderKey other = (BootOrderKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(BootOrderKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/ConfigurableProperties.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/ConfigurableProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..c7371170f4d207b15e46415ece0c4fd34ee90fa6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/ConfigurableProperties.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * It provides VNFC configurable properties that can be modified using the + * ModifyVnfInfo operation. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list configurable-properties {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/vdu/configurable-properties + * + *

To create instances of this class use {@link ConfigurablePropertiesBuilder}. + * @see ConfigurablePropertiesBuilder + * @see ConfigurablePropertiesKey + * + */ +public interface ConfigurableProperties + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("configurable-properties"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.ConfigurableProperties.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + ConfigurablePropertiesKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/ConfigurablePropertiesBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/ConfigurablePropertiesBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..21371ef985c5b1a9e6d0aee9b65aeb3f61888309 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/ConfigurablePropertiesBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ConfigurablePropertiesBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ConfigurablePropertiesBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ConfigurablePropertiesBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ConfigurablePropertiesBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ConfigurablePropertiesBuilder + * @see Builder + * + */ +public class ConfigurablePropertiesBuilder implements Builder { + + private String _key; + private String _value; + private ConfigurablePropertiesKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ConfigurablePropertiesBuilder() { + } + + public ConfigurablePropertiesBuilder(ConfigurableProperties base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public ConfigurablePropertiesKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ConfigurablePropertiesBuilder withKey(final ConfigurablePropertiesKey key) { + this.key = key; + return this; + } + + public ConfigurablePropertiesBuilder setKey(final String value) { + this._key = value; + return this; + } + + public ConfigurablePropertiesBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ConfigurablePropertiesBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ConfigurablePropertiesBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ConfigurablePropertiesBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ConfigurablePropertiesBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ConfigurableProperties build() { + return new ConfigurablePropertiesImpl(this); + } + + private static final class ConfigurablePropertiesImpl + extends AbstractAugmentable + implements ConfigurableProperties { + + private final String _key; + private final String _value; + private final ConfigurablePropertiesKey key; + + ConfigurablePropertiesImpl(ConfigurablePropertiesBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ConfigurablePropertiesKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public ConfigurablePropertiesKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ConfigurableProperties.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ConfigurableProperties other = (ConfigurableProperties)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ConfigurablePropertiesImpl otherImpl = (ConfigurablePropertiesImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ConfigurableProperties"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/ConfigurablePropertiesKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/ConfigurablePropertiesKey.java new file mode 100644 index 0000000000000000000000000000000000000000..6140423a101f0a5d34069cdbf14c208b524bc09c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/ConfigurablePropertiesKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ConfigurablePropertiesKey + implements Identifier { + private static final long serialVersionUID = -9041626256486818420L; + private final String _key; + + + public ConfigurablePropertiesKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ConfigurablePropertiesKey(ConfigurablePropertiesKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ConfigurablePropertiesKey)) { + return false; + } + final ConfigurablePropertiesKey other = (ConfigurablePropertiesKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ConfigurablePropertiesKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/IntCpd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/IntCpd.java new file mode 100644 index 0000000000000000000000000000000000000000..66eea6c9453270ecd15f9a42565ff1b6fdcf083f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/IntCpd.java @@ -0,0 +1,139 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * A internal-connection-point element is a type of connection point and describes + * network connectivity between a VDU instance and an internal Virtual Link or an + * external connection point. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list int-cpd {
+ *   key id;
+ *   min-elements 1;
+ *   leaf int-virtual-link-desc {
+ *     type leafref {
+ *       path ../../../int-virtual-link-desc/id;
+ *     }
+ *   }
+ *   leaf bitrate-requirement {
+ *     type uint64;
+ *     units Mbps;
+ *   }
+ *   uses virtual-network-interface-requirements;
+ *   leaf nicio-requirements {
+ *     type leafref {
+ *       path ../../../virtual-compute-desc/id;
+ *     }
+ *   }
+ *   leaf-list order {
+ *     type uint32;
+ *   }
+ *   uses cpd;
+ *   leaf security-group-rule-id {
+ *     type leafref {
+ *       path ../../../security-group-rule/id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/vdu/int-cpd + * + *

To create instances of this class use {@link IntCpdBuilder}. + * @see IntCpdBuilder + * @see IntCpdKey + * + */ +public interface IntCpd + extends + ChildOf, + Augmentable, + VirtualNetworkInterfaceRequirements, + Cpd, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("int-cpd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.IntCpd.class; + } + + /** + * Reference of the internal VLD which this internal CPD connects to. + * + * + * + * @return java.lang.String intVirtualLinkDesc, or null if not present + */ + @Nullable String getIntVirtualLinkDesc(); + + /** + * Bitrate requirement on this CP. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 bitrateRequirement, or null if not present + */ + @Nullable Uint64 getBitrateRequirement(); + + /** + * This references (couples) the CPD with any logical node I/O requirements (for + * network devices) that may have been created. Linking these attributes is + * necessary so that so that I/O requirements that need to be articulated at the + * logical node level can be associated with the network interface requirements + * associated with the CPD. + * + * + * + * @return java.lang.String nicioRequirements, or null if not present + */ + @Nullable String getNicioRequirements(); + + /** + * The order of the NIC to be assigned on the compute instance (e.g. 2 for eth2). + * Note: when binding more than one port to a single compute (aka multi vNICs) and + * ordering is desired, it is mandatory that all ports will be set with an order + * value. The order values shall represent a positive, arithmetic progression that + * starts with 0 (i.e. 0, 1, 2,..., n). If the property is not present, it shall be + * left to the VIM to assign a value when creating the instance. + * + * + * + * @return java.util.List order, or null if not present + */ + @Nullable List getOrder(); + + /** + * Reference of the security group rules bound to this CPD. + * + * + * + * @return java.lang.String securityGroupRuleId, or null if not present + */ + @Nullable String getSecurityGroupRuleId(); + + @Override + IntCpdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/IntCpdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/IntCpdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..fcede8cc5feb94c21639812fe5541eea8e81504b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/IntCpdBuilder.java @@ -0,0 +1,596 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.CpRole; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.Protocol; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.cpd.ProtocolKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.VirtualNetworkInterfaceRequirement; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.VirtualNetworkInterfaceRequirementKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link IntCpdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     IntCpdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new IntCpdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of IntCpdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see IntCpdBuilder + * @see Builder + * + */ +public class IntCpdBuilder implements Builder { + + private Uint64 _bitrateRequirement; + private String _description; + private String _id; + private String _intVirtualLinkDesc; + private List> _layerProtocol; + private String _nicioRequirements; + private List _order; + private Map _protocol; + private Class _role; + private String _securityGroupRuleId; + private Map _virtualNetworkInterfaceRequirement; + private Boolean _trunkMode; + private IntCpdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public IntCpdBuilder() { + } + public IntCpdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements arg) { + this._virtualNetworkInterfaceRequirement = arg.getVirtualNetworkInterfaceRequirement(); + } + public IntCpdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd arg) { + this._id = arg.getId(); + this._layerProtocol = arg.getLayerProtocol(); + this._role = arg.getRole(); + this._description = arg.getDescription(); + this._protocol = arg.getProtocol(); + this._trunkMode = arg.isTrunkMode(); + } + + public IntCpdBuilder(IntCpd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._bitrateRequirement = base.getBitrateRequirement(); + this._description = base.getDescription(); + this._intVirtualLinkDesc = base.getIntVirtualLinkDesc(); + this._layerProtocol = base.getLayerProtocol(); + this._nicioRequirements = base.getNicioRequirements(); + this._order = base.getOrder(); + this._protocol = base.getProtocol(); + this._role = base.getRole(); + this._securityGroupRuleId = base.getSecurityGroupRuleId(); + this._virtualNetworkInterfaceRequirement = base.getVirtualNetworkInterfaceRequirement(); + this._trunkMode = base.isTrunkMode(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements) { + this._virtualNetworkInterfaceRequirement = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements)arg).getVirtualNetworkInterfaceRequirement(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd) { + this._id = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getId(); + this._layerProtocol = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getLayerProtocol(); + this._role = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getRole(); + this._description = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getDescription(); + this._protocol = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).getProtocol(); + this._trunkMode = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd)arg).isTrunkMode(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.VirtualNetworkInterfaceRequirements, org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Cpd]"); + } + + public IntCpdKey key() { + return key; + } + + public Uint64 getBitrateRequirement() { + return _bitrateRequirement; + } + + public String getDescription() { + return _description; + } + + public String getId() { + return _id; + } + + public String getIntVirtualLinkDesc() { + return _intVirtualLinkDesc; + } + + public List> getLayerProtocol() { + return _layerProtocol; + } + + public String getNicioRequirements() { + return _nicioRequirements; + } + + public List getOrder() { + return _order; + } + + public Map getProtocol() { + return _protocol; + } + + public Class getRole() { + return _role; + } + + public String getSecurityGroupRuleId() { + return _securityGroupRuleId; + } + + public Map getVirtualNetworkInterfaceRequirement() { + return _virtualNetworkInterfaceRequirement; + } + + public Boolean isTrunkMode() { + return _trunkMode; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public IntCpdBuilder withKey(final IntCpdKey key) { + this.key = key; + return this; + } + + public IntCpdBuilder setBitrateRequirement(final Uint64 value) { + this._bitrateRequirement = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setBitrateRequirement(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public IntCpdBuilder setBitrateRequirement(final BigInteger value) { + return setBitrateRequirement(CodeHelpers.compatUint(value)); + } + + public IntCpdBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public IntCpdBuilder setId(final String value) { + this._id = value; + return this; + } + + public IntCpdBuilder setIntVirtualLinkDesc(final String value) { + this._intVirtualLinkDesc = value; + return this; + } + public IntCpdBuilder setLayerProtocol(final List> values) { + this._layerProtocol = values; + return this; + } + + + public IntCpdBuilder setNicioRequirements(final String value) { + this._nicioRequirements = value; + return this; + } + public IntCpdBuilder setOrder(final List values) { + this._order = values; + return this; + } + + public IntCpdBuilder setProtocol(final Map values) { + this._protocol = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setProtocol(Map)} instead. + */ + @Deprecated(forRemoval = true) + public IntCpdBuilder setProtocol(final List values) { + return setProtocol(CodeHelpers.compatMap(values)); + } + + public IntCpdBuilder setRole(final Class value) { + this._role = value; + return this; + } + + public IntCpdBuilder setSecurityGroupRuleId(final String value) { + this._securityGroupRuleId = value; + return this; + } + public IntCpdBuilder setVirtualNetworkInterfaceRequirement(final Map values) { + this._virtualNetworkInterfaceRequirement = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualNetworkInterfaceRequirement(Map)} instead. + */ + @Deprecated(forRemoval = true) + public IntCpdBuilder setVirtualNetworkInterfaceRequirement(final List values) { + return setVirtualNetworkInterfaceRequirement(CodeHelpers.compatMap(values)); + } + + public IntCpdBuilder setTrunkMode(final Boolean value) { + this._trunkMode = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public IntCpdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public IntCpdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public IntCpdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private IntCpdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public IntCpd build() { + return new IntCpdImpl(this); + } + + private static final class IntCpdImpl + extends AbstractAugmentable + implements IntCpd { + + private final Uint64 _bitrateRequirement; + private final String _description; + private final String _id; + private final String _intVirtualLinkDesc; + private final List> _layerProtocol; + private final String _nicioRequirements; + private final List _order; + private final Map _protocol; + private final Class _role; + private final String _securityGroupRuleId; + private final Map _virtualNetworkInterfaceRequirement; + private final Boolean _trunkMode; + private final IntCpdKey key; + + IntCpdImpl(IntCpdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new IntCpdKey(base.getId()); + } + this._id = key.getId(); + this._bitrateRequirement = base.getBitrateRequirement(); + this._description = base.getDescription(); + this._intVirtualLinkDesc = base.getIntVirtualLinkDesc(); + this._layerProtocol = base.getLayerProtocol(); + this._nicioRequirements = base.getNicioRequirements(); + this._order = base.getOrder(); + this._protocol = CodeHelpers.emptyToNull(base.getProtocol()); + this._role = base.getRole(); + this._securityGroupRuleId = base.getSecurityGroupRuleId(); + this._virtualNetworkInterfaceRequirement = CodeHelpers.emptyToNull(base.getVirtualNetworkInterfaceRequirement()); + this._trunkMode = base.isTrunkMode(); + } + + @Override + public IntCpdKey key() { + return key; + } + + @Override + public Uint64 getBitrateRequirement() { + return _bitrateRequirement; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getIntVirtualLinkDesc() { + return _intVirtualLinkDesc; + } + + @Override + public List> getLayerProtocol() { + return _layerProtocol; + } + + @Override + public String getNicioRequirements() { + return _nicioRequirements; + } + + @Override + public List getOrder() { + return _order; + } + + @Override + public Map getProtocol() { + return _protocol; + } + + @Override + public Class getRole() { + return _role; + } + + @Override + public String getSecurityGroupRuleId() { + return _securityGroupRuleId; + } + + @Override + public Map getVirtualNetworkInterfaceRequirement() { + return _virtualNetworkInterfaceRequirement; + } + + @Override + public Boolean isTrunkMode() { + return _trunkMode; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_bitrateRequirement); + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_intVirtualLinkDesc); + result = prime * result + Objects.hashCode(_layerProtocol); + result = prime * result + Objects.hashCode(_nicioRequirements); + result = prime * result + Objects.hashCode(_order); + result = prime * result + Objects.hashCode(_protocol); + result = prime * result + Objects.hashCode(_role); + result = prime * result + Objects.hashCode(_securityGroupRuleId); + result = prime * result + Objects.hashCode(_virtualNetworkInterfaceRequirement); + result = prime * result + Objects.hashCode(_trunkMode); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!IntCpd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + IntCpd other = (IntCpd)obj; + if (!Objects.equals(_bitrateRequirement, other.getBitrateRequirement())) { + return false; + } + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_intVirtualLinkDesc, other.getIntVirtualLinkDesc())) { + return false; + } + if (!Objects.equals(_layerProtocol, other.getLayerProtocol())) { + return false; + } + if (!Objects.equals(_nicioRequirements, other.getNicioRequirements())) { + return false; + } + if (!Objects.equals(_order, other.getOrder())) { + return false; + } + if (!Objects.equals(_protocol, other.getProtocol())) { + return false; + } + if (!Objects.equals(_role, other.getRole())) { + return false; + } + if (!Objects.equals(_securityGroupRuleId, other.getSecurityGroupRuleId())) { + return false; + } + if (!Objects.equals(_virtualNetworkInterfaceRequirement, other.getVirtualNetworkInterfaceRequirement())) { + return false; + } + if (!Objects.equals(_trunkMode, other.isTrunkMode())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + IntCpdImpl otherImpl = (IntCpdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("IntCpd"); + CodeHelpers.appendValue(helper, "_bitrateRequirement", _bitrateRequirement); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_intVirtualLinkDesc", _intVirtualLinkDesc); + CodeHelpers.appendValue(helper, "_layerProtocol", _layerProtocol); + CodeHelpers.appendValue(helper, "_nicioRequirements", _nicioRequirements); + CodeHelpers.appendValue(helper, "_order", _order); + CodeHelpers.appendValue(helper, "_protocol", _protocol); + CodeHelpers.appendValue(helper, "_role", _role); + CodeHelpers.appendValue(helper, "_securityGroupRuleId", _securityGroupRuleId); + CodeHelpers.appendValue(helper, "_virtualNetworkInterfaceRequirement", _virtualNetworkInterfaceRequirement); + CodeHelpers.appendValue(helper, "_trunkMode", _trunkMode); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/IntCpdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/IntCpdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..de47a7815ab5dd6de71d61f1f4f4c9700feed34d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/IntCpdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class IntCpdKey + implements Identifier { + private static final long serialVersionUID = 1649222683231827626L; + private final String _id; + + + public IntCpdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public IntCpdKey(IntCpdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof IntCpdKey)) { + return false; + } + final IntCpdKey other = (IntCpdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(IntCpdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/MonitoringParameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/MonitoringParameter.java new file mode 100644 index 0000000000000000000000000000000000000000..7dc067ef406f9ee845fd9fa6ca452f7d5762ffd4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/MonitoringParameter.java @@ -0,0 +1,64 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list monitoring-parameter {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   uses monitoring-parameter;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/vdu/monitoring-parameter + * + *

To create instances of this class use {@link MonitoringParameterBuilder}. + * @see MonitoringParameterBuilder + * @see MonitoringParameterKey + * + */ +public interface MonitoringParameter + extends + ChildOf, + Augmentable, + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("monitoring-parameter"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu.MonitoringParameter.class; + } + + /** + * Unique identifier of the monitoring parameter. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + @Override + MonitoringParameterKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/MonitoringParameterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/MonitoringParameterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..6635d3b51cd51481914c907747c1092dab6874e7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/MonitoringParameterBuilder.java @@ -0,0 +1,355 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link MonitoringParameterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     MonitoringParameterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new MonitoringParameterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of MonitoringParameterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see MonitoringParameterBuilder + * @see Builder + * + */ +public class MonitoringParameterBuilder implements Builder { + + private Uint64 _collectionPeriod; + private String _id; + private String _name; + private String _performanceMetric; + private MonitoringParameterKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public MonitoringParameterBuilder() { + } + public MonitoringParameterBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter arg) { + this._name = arg.getName(); + this._performanceMetric = arg.getPerformanceMetric(); + this._collectionPeriod = arg.getCollectionPeriod(); + } + + public MonitoringParameterBuilder(MonitoringParameter base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._collectionPeriod = base.getCollectionPeriod(); + this._name = base.getName(); + this._performanceMetric = base.getPerformanceMetric(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter) { + this._name = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter)arg).getName(); + this._performanceMetric = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter)arg).getPerformanceMetric(); + this._collectionPeriod = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter)arg).getCollectionPeriod(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.MonitoringParameter]"); + } + + public MonitoringParameterKey key() { + return key; + } + + public Uint64 getCollectionPeriod() { + return _collectionPeriod; + } + + public String getId() { + return _id; + } + + public String getName() { + return _name; + } + + public String getPerformanceMetric() { + return _performanceMetric; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public MonitoringParameterBuilder withKey(final MonitoringParameterKey key) { + this.key = key; + return this; + } + + public MonitoringParameterBuilder setCollectionPeriod(final Uint64 value) { + this._collectionPeriod = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setCollectionPeriod(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public MonitoringParameterBuilder setCollectionPeriod(final BigInteger value) { + return setCollectionPeriod(CodeHelpers.compatUint(value)); + } + + public MonitoringParameterBuilder setId(final String value) { + this._id = value; + return this; + } + + public MonitoringParameterBuilder setName(final String value) { + this._name = value; + return this; + } + + public MonitoringParameterBuilder setPerformanceMetric(final String value) { + this._performanceMetric = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public MonitoringParameterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public MonitoringParameterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public MonitoringParameterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private MonitoringParameterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public MonitoringParameter build() { + return new MonitoringParameterImpl(this); + } + + private static final class MonitoringParameterImpl + extends AbstractAugmentable + implements MonitoringParameter { + + private final Uint64 _collectionPeriod; + private final String _id; + private final String _name; + private final String _performanceMetric; + private final MonitoringParameterKey key; + + MonitoringParameterImpl(MonitoringParameterBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new MonitoringParameterKey(base.getId()); + } + this._id = key.getId(); + this._collectionPeriod = base.getCollectionPeriod(); + this._name = base.getName(); + this._performanceMetric = base.getPerformanceMetric(); + } + + @Override + public MonitoringParameterKey key() { + return key; + } + + @Override + public Uint64 getCollectionPeriod() { + return _collectionPeriod; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getName() { + return _name; + } + + @Override + public String getPerformanceMetric() { + return _performanceMetric; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_collectionPeriod); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_performanceMetric); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!MonitoringParameter.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + MonitoringParameter other = (MonitoringParameter)obj; + if (!Objects.equals(_collectionPeriod, other.getCollectionPeriod())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_performanceMetric, other.getPerformanceMetric())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + MonitoringParameterImpl otherImpl = (MonitoringParameterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("MonitoringParameter"); + CodeHelpers.appendValue(helper, "_collectionPeriod", _collectionPeriod); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_performanceMetric", _performanceMetric); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/MonitoringParameterKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/MonitoringParameterKey.java new file mode 100644 index 0000000000000000000000000000000000000000..12f3d1d5e1e77ed60917998b20147a7c991a5f63 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/vdu/MonitoringParameterKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.vdu; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class MonitoringParameterKey + implements Identifier { + private static final long serialVersionUID = 7526161979845181524L; + private final String _id; + + + public MonitoringParameterKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public MonitoringParameterKey(MonitoringParameterKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof MonitoringParameterKey)) { + return false; + } + final MonitoringParameterKey other = (MonitoringParameterKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(MonitoringParameterKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/LogicalNode.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/LogicalNode.java new file mode 100644 index 0000000000000000000000000000000000000000..8f992146364764ce6a58c2e94a0a8ca4c63947df --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/LogicalNode.java @@ -0,0 +1,97 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.logical.node.RequirementDetail; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.logical.node.RequirementDetailKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The logical node requirements. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list logical-node {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   list requirement-detail {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-compute-desc/logical-node + * + *

To create instances of this class use {@link LogicalNodeBuilder}. + * @see LogicalNodeBuilder + * @see LogicalNodeKey + * + */ +public interface LogicalNode + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("logical-node"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.LogicalNode.class; + } + + /** + * Identifies this set of logical node requirements. + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * The logical node-level compute, memory and I/O requirements. An array of + * key-value pairs that articulate the deployment requirements. This could include + * the number of CPU cores on this logical node, a memory configuration specific to + * a logical node (e.g. such as available in the Linux kernel via the libnuma + * library) or a requirement related to the association of an I/O device with the + * logical node. + * + * + * + * @return java.util.Map requirementDetail, or null if not present + */ + @Nullable Map getRequirementDetail(); + + /** + * @return java.util.Map requirementDetail, or an empty list if it is not present + */ + default @NonNull Map nonnullRequirementDetail() { + return CodeHelpers.nonnull(getRequirementDetail()); + } + + @Override + LogicalNodeKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/LogicalNodeBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/LogicalNodeBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..0ca4cef8379940aa5be37ab16a433b59d1c9ec72 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/LogicalNodeBuilder.java @@ -0,0 +1,291 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.logical.node.RequirementDetail; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.logical.node.RequirementDetailKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link LogicalNodeBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     LogicalNodeBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new LogicalNodeBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of LogicalNodeBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see LogicalNodeBuilder + * @see Builder + * + */ +public class LogicalNodeBuilder implements Builder { + + private String _id; + private Map _requirementDetail; + private LogicalNodeKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public LogicalNodeBuilder() { + } + + public LogicalNodeBuilder(LogicalNode base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._requirementDetail = base.getRequirementDetail(); + } + + + public LogicalNodeKey key() { + return key; + } + + public String getId() { + return _id; + } + + public Map getRequirementDetail() { + return _requirementDetail; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public LogicalNodeBuilder withKey(final LogicalNodeKey key) { + this.key = key; + return this; + } + + public LogicalNodeBuilder setId(final String value) { + this._id = value; + return this; + } + public LogicalNodeBuilder setRequirementDetail(final Map values) { + this._requirementDetail = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setRequirementDetail(Map)} instead. + */ + @Deprecated(forRemoval = true) + public LogicalNodeBuilder setRequirementDetail(final List values) { + return setRequirementDetail(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public LogicalNodeBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public LogicalNodeBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public LogicalNodeBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private LogicalNodeBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public LogicalNode build() { + return new LogicalNodeImpl(this); + } + + private static final class LogicalNodeImpl + extends AbstractAugmentable + implements LogicalNode { + + private final String _id; + private final Map _requirementDetail; + private final LogicalNodeKey key; + + LogicalNodeImpl(LogicalNodeBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new LogicalNodeKey(base.getId()); + } + this._id = key.getId(); + this._requirementDetail = CodeHelpers.emptyToNull(base.getRequirementDetail()); + } + + @Override + public LogicalNodeKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getRequirementDetail() { + return _requirementDetail; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_requirementDetail); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!LogicalNode.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + LogicalNode other = (LogicalNode)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_requirementDetail, other.getRequirementDetail())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + LogicalNodeImpl otherImpl = (LogicalNodeImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("LogicalNode"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_requirementDetail", _requirementDetail); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/LogicalNodeKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/LogicalNodeKey.java new file mode 100644 index 0000000000000000000000000000000000000000..4f0be198dd458f9df1f97b0f9782dc32a70dc5f1 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/LogicalNodeKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class LogicalNodeKey + implements Identifier { + private static final long serialVersionUID = -4626432151267284245L; + private final String _id; + + + public LogicalNodeKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public LogicalNodeKey(LogicalNodeKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof LogicalNodeKey)) { + return false; + } + final LogicalNodeKey other = (LogicalNodeKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(LogicalNodeKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/RequestAdditionalCapability.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/RequestAdditionalCapability.java new file mode 100644 index 0000000000000000000000000000000000000000..56f18d3c09bfdd3fba7f94ecadffb3d61b85508b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/RequestAdditionalCapability.java @@ -0,0 +1,131 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.request.additional.capability.TargetPerformanceParameters; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.request.additional.capability.TargetPerformanceParametersKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list request-additional-capability {
+ *   key name;
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf support-mandatory {
+ *     type boolean;
+ *   }
+ *   leaf min-version {
+ *     type string;
+ *   }
+ *   leaf preferred-version {
+ *     type string;
+ *   }
+ *   list target-performance-parameters {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-compute-desc/request-additional-capability + * + *

To create instances of this class use {@link RequestAdditionalCapabilityBuilder}. + * @see RequestAdditionalCapabilityBuilder + * @see RequestAdditionalCapabilityKey + * + */ +public interface RequestAdditionalCapability + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("request-additional-capability"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.RequestAdditionalCapability.class; + } + + /** + * Identifies a requested additional capability for the VDU. ETSI GS NFV-IFA 002 + * [i.1] describes acceleration capabilities. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Indicates whether the requested additional capability is mandatory for + * successful operation. + * + * + * + * @return java.lang.Boolean supportMandatory, or null if not present + */ + @Nullable Boolean isSupportMandatory(); + + /** + * Identifies the minimum version of the requested additional capability. + * + * + * + * @return java.lang.String minVersion, or null if not present + */ + @Nullable String getMinVersion(); + + /** + * Identifies the preferred version of the requested additional capability. + * + * + * + * @return java.lang.String preferredVersion, or null if not present + */ + @Nullable String getPreferredVersion(); + + /** + * Identifies specific attributes, dependent on the requested additional capability + * type. + * + * + * + * @return java.util.Map targetPerformanceParameters, or null if not present + */ + @Nullable Map getTargetPerformanceParameters(); + + /** + * @return java.util.Map targetPerformanceParameters, or an empty list if it is not present + */ + default @NonNull Map nonnullTargetPerformanceParameters() { + return CodeHelpers.nonnull(getTargetPerformanceParameters()); + } + + @Override + RequestAdditionalCapabilityKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/RequestAdditionalCapabilityBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/RequestAdditionalCapabilityBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..b833b8ae3d727ed417aa2d4699eb0e2dd9adab8f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/RequestAdditionalCapabilityBuilder.java @@ -0,0 +1,361 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.request.additional.capability.TargetPerformanceParameters; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.request.additional.capability.TargetPerformanceParametersKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link RequestAdditionalCapabilityBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     RequestAdditionalCapabilityBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new RequestAdditionalCapabilityBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of RequestAdditionalCapabilityBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see RequestAdditionalCapabilityBuilder + * @see Builder + * + */ +public class RequestAdditionalCapabilityBuilder implements Builder { + + private String _minVersion; + private String _name; + private String _preferredVersion; + private Map _targetPerformanceParameters; + private Boolean _supportMandatory; + private RequestAdditionalCapabilityKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public RequestAdditionalCapabilityBuilder() { + } + + public RequestAdditionalCapabilityBuilder(RequestAdditionalCapability base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._name = base.getName(); + this._minVersion = base.getMinVersion(); + this._preferredVersion = base.getPreferredVersion(); + this._targetPerformanceParameters = base.getTargetPerformanceParameters(); + this._supportMandatory = base.isSupportMandatory(); + } + + + public RequestAdditionalCapabilityKey key() { + return key; + } + + public String getMinVersion() { + return _minVersion; + } + + public String getName() { + return _name; + } + + public String getPreferredVersion() { + return _preferredVersion; + } + + public Map getTargetPerformanceParameters() { + return _targetPerformanceParameters; + } + + public Boolean isSupportMandatory() { + return _supportMandatory; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public RequestAdditionalCapabilityBuilder withKey(final RequestAdditionalCapabilityKey key) { + this.key = key; + return this; + } + + public RequestAdditionalCapabilityBuilder setMinVersion(final String value) { + this._minVersion = value; + return this; + } + + public RequestAdditionalCapabilityBuilder setName(final String value) { + this._name = value; + return this; + } + + public RequestAdditionalCapabilityBuilder setPreferredVersion(final String value) { + this._preferredVersion = value; + return this; + } + public RequestAdditionalCapabilityBuilder setTargetPerformanceParameters(final Map values) { + this._targetPerformanceParameters = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setTargetPerformanceParameters(Map)} instead. + */ + @Deprecated(forRemoval = true) + public RequestAdditionalCapabilityBuilder setTargetPerformanceParameters(final List values) { + return setTargetPerformanceParameters(CodeHelpers.compatMap(values)); + } + + public RequestAdditionalCapabilityBuilder setSupportMandatory(final Boolean value) { + this._supportMandatory = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public RequestAdditionalCapabilityBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public RequestAdditionalCapabilityBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public RequestAdditionalCapabilityBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private RequestAdditionalCapabilityBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public RequestAdditionalCapability build() { + return new RequestAdditionalCapabilityImpl(this); + } + + private static final class RequestAdditionalCapabilityImpl + extends AbstractAugmentable + implements RequestAdditionalCapability { + + private final String _minVersion; + private final String _name; + private final String _preferredVersion; + private final Map _targetPerformanceParameters; + private final Boolean _supportMandatory; + private final RequestAdditionalCapabilityKey key; + + RequestAdditionalCapabilityImpl(RequestAdditionalCapabilityBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new RequestAdditionalCapabilityKey(base.getName()); + } + this._name = key.getName(); + this._minVersion = base.getMinVersion(); + this._preferredVersion = base.getPreferredVersion(); + this._targetPerformanceParameters = CodeHelpers.emptyToNull(base.getTargetPerformanceParameters()); + this._supportMandatory = base.isSupportMandatory(); + } + + @Override + public RequestAdditionalCapabilityKey key() { + return key; + } + + @Override + public String getMinVersion() { + return _minVersion; + } + + @Override + public String getName() { + return _name; + } + + @Override + public String getPreferredVersion() { + return _preferredVersion; + } + + @Override + public Map getTargetPerformanceParameters() { + return _targetPerformanceParameters; + } + + @Override + public Boolean isSupportMandatory() { + return _supportMandatory; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_minVersion); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_preferredVersion); + result = prime * result + Objects.hashCode(_targetPerformanceParameters); + result = prime * result + Objects.hashCode(_supportMandatory); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!RequestAdditionalCapability.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + RequestAdditionalCapability other = (RequestAdditionalCapability)obj; + if (!Objects.equals(_minVersion, other.getMinVersion())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_preferredVersion, other.getPreferredVersion())) { + return false; + } + if (!Objects.equals(_targetPerformanceParameters, other.getTargetPerformanceParameters())) { + return false; + } + if (!Objects.equals(_supportMandatory, other.isSupportMandatory())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + RequestAdditionalCapabilityImpl otherImpl = (RequestAdditionalCapabilityImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("RequestAdditionalCapability"); + CodeHelpers.appendValue(helper, "_minVersion", _minVersion); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_preferredVersion", _preferredVersion); + CodeHelpers.appendValue(helper, "_targetPerformanceParameters", _targetPerformanceParameters); + CodeHelpers.appendValue(helper, "_supportMandatory", _supportMandatory); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/RequestAdditionalCapabilityKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/RequestAdditionalCapabilityKey.java new file mode 100644 index 0000000000000000000000000000000000000000..6bbcfe33bb371101285ed7fd06fb0ecfdfcf6469 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/RequestAdditionalCapabilityKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class RequestAdditionalCapabilityKey + implements Identifier { + private static final long serialVersionUID = -6816285377424317935L; + private final String _name; + + + public RequestAdditionalCapabilityKey(String _name) { + + this._name = _name; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public RequestAdditionalCapabilityKey(RequestAdditionalCapabilityKey source) { + this._name = source._name; + } + + + public String getName() { + return _name; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_name); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof RequestAdditionalCapabilityKey)) { + return false; + } + final RequestAdditionalCapabilityKey other = (RequestAdditionalCapabilityKey) obj; + if (!Objects.equals(_name, other._name)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(RequestAdditionalCapabilityKey.class); + CodeHelpers.appendValue(helper, "_name", _name); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualCpu.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualCpu.java new file mode 100644 index 0000000000000000000000000000000000000000..c94b2256762921867975417041dbcb6de9fb9299 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualCpu.java @@ -0,0 +1,168 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VduBuilder.VduImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualCpuBuilder.VirtualCpuImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.Pinning; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.VduCpuRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.VduCpuRequirementsKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint16; +import org.opendaylight.yangtools.yang.common.Uint32; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * The virtual CPU(s)of the virtualised compute. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container virtual-cpu {
+ *   leaf cpu-architecture {
+ *     type string;
+ *   }
+ *   leaf num-virtual-cpu {
+ *     type uint16 {
+ *       range 1..max;
+ *     }
+ *     default 1;
+ *   }
+ *   leaf clock {
+ *     type uint32;
+ *     units MHz;
+ *   }
+ *   leaf oversubscription-policy {
+ *     type string;
+ *   }
+ *   list vdu-cpu-requirements {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ *   container pinning {
+ *     presence "Set to specify CPU pinning.";
+ *     leaf policy {
+ *       default dynamic;
+ *       type enumeration {
+ *         enum static;
+ *         enum dynamic;
+ *       }
+ *     }
+ *     list rule {
+ *       when "../policy = 'static'";
+ *       key key;
+ *       leaf key {
+ *         type string;
+ *       }
+ *       leaf value {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-compute-desc/virtual-cpu + * + *

To create instances of this class use {@link VirtualCpuBuilder}. + * @see VirtualCpuBuilder + * + */ +@JsonDeserialize(as = VirtualCpuImpl.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public interface VirtualCpu + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-cpu"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualCpu.class; + } + + /** + * CPU architecture type. Examples are x86, ARM. The cardinality can be 0 during + * the allocation request, if no particular CPU architecture type is requested. + * + * + * + * @return java.lang.String cpuArchitecture, or null if not present + */ + @Nullable String getCpuArchitecture(); + + /** + * Number of virtual CPUs. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 numVirtualCpu, or null if not present + */ + @Nullable Uint16 getNumVirtualCpu(); + + /** + * Minimum virtual CPU clock rate (e.g. in MHz). The cardinality can be 0 during + * the allocation request, if no particular value is requested. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 clock, or null if not present + */ + @Nullable Uint32 getClock(); + + /** + * The CPU core oversubscription policy e.g. the relation of virtual CPU cores to + * physical CPU cores/threads. The cardinality can be 0 during the allocation + * request, if no particular value is requested. + * + * + * + * @return java.lang.String oversubscriptionPolicy, or null if not present + */ + @Nullable String getOversubscriptionPolicy(); + + /** + * Array of key-value pair requirements on the compute (CPU) for the VDU. + * + * + * + * @return java.util.Map vduCpuRequirements, or null if not present + */ + @Nullable Map getVduCpuRequirements(); + + /** + * @return java.util.Map vduCpuRequirements, or an empty list if it is not present + */ + default @NonNull Map nonnullVduCpuRequirements() { + return CodeHelpers.nonnull(getVduCpuRequirements()); + } + + /** + * The virtual CPU pinning configuration for the virtualised compute resource. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.Pinning pinning, or null if not present + */ + @Nullable Pinning getPinning(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualCpuBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualCpuBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..760dbcf5052afd2f0eaf517d261e4f3fa06d3592 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualCpuBuilder.java @@ -0,0 +1,410 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Integer; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDescBuilder; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.Pinning; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.VduCpuRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.VduCpuRequirementsKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint16; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link VirtualCpuBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualCpuBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualCpuBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualCpuBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualCpuBuilder + * @see Builder + * + */ +public class VirtualCpuBuilder implements Builder { + + private Uint32 _clock; + private String _cpuArchitecture; + private Uint16 _numVirtualCpu; + private String _oversubscriptionPolicy; + private Pinning _pinning; + private Map _vduCpuRequirements; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualCpuBuilder() { + } + + public VirtualCpuBuilder(VirtualCpu base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._clock = base.getClock(); + this._cpuArchitecture = base.getCpuArchitecture(); + this._numVirtualCpu = base.getNumVirtualCpu(); + this._oversubscriptionPolicy = base.getOversubscriptionPolicy(); + this._pinning = base.getPinning(); + this._vduCpuRequirements = base.getVduCpuRequirements(); + } + + + public Uint32 getClock() { + return _clock; + } + + public String getCpuArchitecture() { + return _cpuArchitecture; + } + + public Uint16 getNumVirtualCpu() { + return _numVirtualCpu; + } + + public String getOversubscriptionPolicy() { + return _oversubscriptionPolicy; + } + + public Pinning getPinning() { + return _pinning; + } + + public Map getVduCpuRequirements() { + return _vduCpuRequirements; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VirtualCpuBuilder setClock(final Uint32 value) { + this._clock = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setClock(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualCpuBuilder setClock(final Long value) { + return setClock(CodeHelpers.compatUint(value)); + } + + public VirtualCpuBuilder setCpuArchitecture(final String value) { + this._cpuArchitecture = value; + return this; + } + + private static void checkNumVirtualCpuRange(final int value) { + if (value >= 1) { + return; + } + CodeHelpers.throwInvalidRange("[[1..65535]]", value); + } + + public VirtualCpuBuilder setNumVirtualCpu(final Uint16 value) { + if (value != null) { + checkNumVirtualCpuRange(value.intValue()); + + } + this._numVirtualCpu = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setNumVirtualCpu(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualCpuBuilder setNumVirtualCpu(final Integer value) { + return setNumVirtualCpu(CodeHelpers.compatUint(value)); + } + + public VirtualCpuBuilder setOversubscriptionPolicy(final String value) { + this._oversubscriptionPolicy = value; + return this; + } + + public VirtualCpuBuilder setPinning(final Pinning value) { + this._pinning = value; + return this; + } + public VirtualCpuBuilder setVduCpuRequirements(final Map values) { + this._vduCpuRequirements = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVduCpuRequirements(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualCpuBuilder setVduCpuRequirements(final List values) { + return setVduCpuRequirements(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualCpuBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualCpuBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualCpuBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualCpuBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualCpu build() { + return new VirtualCpuImpl(this); + } + + public static final class VirtualCpuImpl + extends AbstractAugmentable + implements VirtualCpu { + + private final Uint32 _clock; + private final String _cpuArchitecture; + @JsonProperty("num-virtual-cpu") + private final Uint16 _numVirtualCpu; + private final String _oversubscriptionPolicy; + private final Pinning _pinning; + private final Map _vduCpuRequirements; + + VirtualCpuImpl(VirtualCpuBuilder base) { + super(base.augmentation); + this._clock = base.getClock(); + this._cpuArchitecture = base.getCpuArchitecture(); + this._numVirtualCpu = base.getNumVirtualCpu(); + this._oversubscriptionPolicy = base.getOversubscriptionPolicy(); + this._pinning = base.getPinning(); + this._vduCpuRequirements = CodeHelpers.emptyToNull(base.getVduCpuRequirements()); + } + + public VirtualCpuImpl() { + this( new VirtualCpuBuilder()); + } + + @Override + public Uint32 getClock() { + return _clock; + } + + @Override + public String getCpuArchitecture() { + return _cpuArchitecture; + } + + @Override + public Uint16 getNumVirtualCpu() { + return _numVirtualCpu; + } + + @Override + public String getOversubscriptionPolicy() { + return _oversubscriptionPolicy; + } + + @Override + public Pinning getPinning() { + return _pinning; + } + + @Override + public Map getVduCpuRequirements() { + return _vduCpuRequirements; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_clock); + result = prime * result + Objects.hashCode(_cpuArchitecture); + result = prime * result + Objects.hashCode(_numVirtualCpu); + result = prime * result + Objects.hashCode(_oversubscriptionPolicy); + result = prime * result + Objects.hashCode(_pinning); + result = prime * result + Objects.hashCode(_vduCpuRequirements); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualCpu.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualCpu other = (VirtualCpu)obj; + if (!Objects.equals(_clock, other.getClock())) { + return false; + } + if (!Objects.equals(_cpuArchitecture, other.getCpuArchitecture())) { + return false; + } + if (!Objects.equals(_numVirtualCpu, other.getNumVirtualCpu())) { + return false; + } + if (!Objects.equals(_oversubscriptionPolicy, other.getOversubscriptionPolicy())) { + return false; + } + if (!Objects.equals(_pinning, other.getPinning())) { + return false; + } + if (!Objects.equals(_vduCpuRequirements, other.getVduCpuRequirements())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualCpuImpl otherImpl = (VirtualCpuImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualCpu"); + CodeHelpers.appendValue(helper, "_clock", _clock); + CodeHelpers.appendValue(helper, "_cpuArchitecture", _cpuArchitecture); + CodeHelpers.appendValue(helper, "_numVirtualCpu", _numVirtualCpu); + CodeHelpers.appendValue(helper, "_oversubscriptionPolicy", _oversubscriptionPolicy); + CodeHelpers.appendValue(helper, "_pinning", _pinning); + CodeHelpers.appendValue(helper, "_vduCpuRequirements", _vduCpuRequirements); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualMemory.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualMemory.java new file mode 100644 index 0000000000000000000000000000000000000000..a12086ee0c884a8636f50fa532ed669d3ca158bf --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualMemory.java @@ -0,0 +1,127 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.math.BigDecimal; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualCpuBuilder.VirtualCpuImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualMemoryBuilder.VirtualMemoryImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.memory.VduMemRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.memory.VduMemRequirementsKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * The virtual memory of the virtualised compute. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container virtual-memory {
+ *   leaf size {
+ *     type decimal64 {
+ *       fraction-digits 1;
+ *       range 0..max;
+ *     }
+ *     units GB;
+ *     default 1;
+ *   }
+ *   leaf over-subscription-policy {
+ *     type string;
+ *   }
+ *   list vdu-mem-requirements {
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ *   leaf numa-enabled {
+ *     type boolean;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-compute-desc/virtual-memory + * + *

To create instances of this class use {@link VirtualMemoryBuilder}. + * @see VirtualMemoryBuilder + * + */ +@JsonDeserialize(as = VirtualMemoryImpl.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public interface VirtualMemory + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-memory"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualMemory.class; + } + + /** + * Amount of virtual memory in GB. + * + * + * + * @return java.math.BigDecimal size, or null if not present + */ + @Nullable BigDecimal getSize(); + + /** + * The memory core oversubscription policy in terms of virtual memory to physical + * memory on the platform. The cardinality can be 0 during the allocation request, + * if no particular value is requested. + * + * + * + * @return java.lang.String overSubscriptionPolicy, or null if not present + */ + @Nullable String getOverSubscriptionPolicy(); + + /** + * Array of key-value pair requirements on the memory for the VDU. + * + * + * + * @return java.util.Map vduMemRequirements, or null if not present + */ + @Nullable Map getVduMemRequirements(); + + /** + * @return java.util.Map vduMemRequirements, or an empty list if it is not present + */ + default @NonNull Map nonnullVduMemRequirements() { + return CodeHelpers.nonnull(getVduMemRequirements()); + } + + /** + * It specifies the memory allocation to be cognisant of the relevant process/core + * allocation. The cardinality can be 0 during the allocation request, if no + * particular value is requested. + * + * + * + * @return java.lang.Boolean numaEnabled, or null if not present + */ + @Nullable Boolean isNumaEnabled(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualMemoryBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualMemoryBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..3086e2b62f6b0536e3f3c2ea2bb4b4ad8956528c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/VirtualMemoryBuilder.java @@ -0,0 +1,348 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.MoreObjects; +import com.google.common.collect.Range; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.lang.reflect.Array; +import java.math.BigDecimal; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.memory.VduMemRequirements; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.memory.VduMemRequirementsKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualMemoryBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualMemoryBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualMemoryBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualMemoryBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualMemoryBuilder + * @see Builder + * + */ +public class VirtualMemoryBuilder implements Builder { + + private String _overSubscriptionPolicy; + private BigDecimal _size; + private Map _vduMemRequirements; + private Boolean _numaEnabled; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualMemoryBuilder() { + } + + public VirtualMemoryBuilder(VirtualMemory base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._overSubscriptionPolicy = base.getOverSubscriptionPolicy(); + this._size = base.getSize(); + this._vduMemRequirements = base.getVduMemRequirements(); + this._numaEnabled = base.isNumaEnabled(); + } + + + public String getOverSubscriptionPolicy() { + return _overSubscriptionPolicy; + } + + public BigDecimal getSize() { + return _size; + } + + public Map getVduMemRequirements() { + return _vduMemRequirements; + } + + public Boolean isNumaEnabled() { + return _numaEnabled; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VirtualMemoryBuilder setOverSubscriptionPolicy(final String value) { + this._overSubscriptionPolicy = value; + return this; + } + + private static final Range[] CHECKSIZERANGE_RANGES; + static { + @SuppressWarnings("unchecked") + final Range[] a = (Range[]) Array.newInstance(Range.class, 1); + a[0] = Range.closed(java.math.BigDecimal.ZERO, new java.math.BigDecimal("922337203685477580.7")); + CHECKSIZERANGE_RANGES = a; + } + private static void checkSizeRange(final java.math.BigDecimal value) { + for (Range r : CHECKSIZERANGE_RANGES) { + if (r.contains(value)) { + return; + } + } + CodeHelpers.throwInvalidRange(CHECKSIZERANGE_RANGES, value); + } + + public VirtualMemoryBuilder setSize(final BigDecimal value) { + if (value != null) { + checkSizeRange(value); + + } + this._size = value; + return this; + } + public VirtualMemoryBuilder setVduMemRequirements(final Map values) { + this._vduMemRequirements = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVduMemRequirements(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualMemoryBuilder setVduMemRequirements(final List values) { + return setVduMemRequirements(CodeHelpers.compatMap(values)); + } + + public VirtualMemoryBuilder setNumaEnabled(final Boolean value) { + this._numaEnabled = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualMemoryBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualMemoryBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualMemoryBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualMemoryBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualMemory build() { + return new VirtualMemoryImpl(this); + } + + public static final class VirtualMemoryImpl + extends AbstractAugmentable + implements VirtualMemory { + + @JsonProperty("over-subscription-policy") + private final String _overSubscriptionPolicy; + @JsonProperty("size") + private final BigDecimal _size; + private final Map _vduMemRequirements; + @JsonProperty("numa-enabled") + private final Boolean _numaEnabled; + + VirtualMemoryImpl(VirtualMemoryBuilder base) { + super(base.augmentation); + this._overSubscriptionPolicy = base.getOverSubscriptionPolicy(); + this._size = base.getSize(); + this._vduMemRequirements = CodeHelpers.emptyToNull(base.getVduMemRequirements()); + this._numaEnabled = base.isNumaEnabled(); + } + + public VirtualMemoryImpl() { + this( new VirtualMemoryBuilder()); + } + + @Override + public String getOverSubscriptionPolicy() { + return _overSubscriptionPolicy; + } + + @Override + public BigDecimal getSize() { + return _size; + } + + @Override + public Map getVduMemRequirements() { + return _vduMemRequirements; + } + + @Override + public Boolean isNumaEnabled() { + return _numaEnabled; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_overSubscriptionPolicy); + result = prime * result + Objects.hashCode(_size); + result = prime * result + Objects.hashCode(_vduMemRequirements); + result = prime * result + Objects.hashCode(_numaEnabled); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualMemory.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualMemory other = (VirtualMemory)obj; + if (!Objects.equals(_overSubscriptionPolicy, other.getOverSubscriptionPolicy())) { + return false; + } + if (!Objects.equals(_size, other.getSize())) { + return false; + } + if (!Objects.equals(_vduMemRequirements, other.getVduMemRequirements())) { + return false; + } + if (!Objects.equals(_numaEnabled, other.isNumaEnabled())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualMemoryImpl otherImpl = (VirtualMemoryImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualMemory"); + CodeHelpers.appendValue(helper, "_overSubscriptionPolicy", _overSubscriptionPolicy); + CodeHelpers.appendValue(helper, "_size", _size); + CodeHelpers.appendValue(helper, "_vduMemRequirements", _vduMemRequirements); + CodeHelpers.appendValue(helper, "_numaEnabled", _numaEnabled); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/logical/node/RequirementDetail.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/logical/node/RequirementDetail.java new file mode 100644 index 0000000000000000000000000000000000000000..c9aeae41285caf7e598d1d21c5659698c31c6f4b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/logical/node/RequirementDetail.java @@ -0,0 +1,72 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.logical.node; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.LogicalNode; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The logical node-level compute, memory and I/O requirements. An array of + * key-value pairs that articulate the deployment requirements. This could include + * the number of CPU cores on this logical node, a memory configuration specific + * a logical node (e.g. such as available in the Linux kernel via the libnuma + * library) or a requirement related to the association of an I/O device with the + * logical node. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list requirement-detail {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-compute-desc/logical-node/requirement-detail + * + *

To create instances of this class use {@link RequirementDetailBuilder}. + * @see RequirementDetailBuilder + * @see RequirementDetailKey + * + */ +public interface RequirementDetail + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("requirement-detail"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.logical.node.RequirementDetail.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + RequirementDetailKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/logical/node/RequirementDetailBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/logical/node/RequirementDetailBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..a83f58d20acca190e4b9bf0ad124131710c5464d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/logical/node/RequirementDetailBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.logical.node; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link RequirementDetailBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     RequirementDetailBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new RequirementDetailBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of RequirementDetailBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see RequirementDetailBuilder + * @see Builder + * + */ +public class RequirementDetailBuilder implements Builder { + + private String _key; + private String _value; + private RequirementDetailKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public RequirementDetailBuilder() { + } + + public RequirementDetailBuilder(RequirementDetail base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public RequirementDetailKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public RequirementDetailBuilder withKey(final RequirementDetailKey key) { + this.key = key; + return this; + } + + public RequirementDetailBuilder setKey(final String value) { + this._key = value; + return this; + } + + public RequirementDetailBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public RequirementDetailBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public RequirementDetailBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public RequirementDetailBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private RequirementDetailBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public RequirementDetail build() { + return new RequirementDetailImpl(this); + } + + private static final class RequirementDetailImpl + extends AbstractAugmentable + implements RequirementDetail { + + private final String _key; + private final String _value; + private final RequirementDetailKey key; + + RequirementDetailImpl(RequirementDetailBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new RequirementDetailKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public RequirementDetailKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!RequirementDetail.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + RequirementDetail other = (RequirementDetail)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + RequirementDetailImpl otherImpl = (RequirementDetailImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("RequirementDetail"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/logical/node/RequirementDetailKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/logical/node/RequirementDetailKey.java new file mode 100644 index 0000000000000000000000000000000000000000..86eee282b8c6485da4c9386de7ac726034324cad --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/logical/node/RequirementDetailKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.logical.node; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class RequirementDetailKey + implements Identifier { + private static final long serialVersionUID = -6256096638926868520L; + private final String _key; + + + public RequirementDetailKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public RequirementDetailKey(RequirementDetailKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof RequirementDetailKey)) { + return false; + } + final RequirementDetailKey other = (RequirementDetailKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(RequirementDetailKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/request/additional/capability/TargetPerformanceParameters.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/request/additional/capability/TargetPerformanceParameters.java new file mode 100644 index 0000000000000000000000000000000000000000..d0c22689f52359519ff1df033b3f7960ae205b72 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/request/additional/capability/TargetPerformanceParameters.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.request.additional.capability; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.RequestAdditionalCapability; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Identifies specific attributes, dependent on the requested additional + * type. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list target-performance-parameters {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-compute-desc/request-additional-capability/target-performance-parameters + * + *

To create instances of this class use {@link TargetPerformanceParametersBuilder}. + * @see TargetPerformanceParametersBuilder + * @see TargetPerformanceParametersKey + * + */ +public interface TargetPerformanceParameters + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("target-performance-parameters"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.request.additional.capability.TargetPerformanceParameters.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + TargetPerformanceParametersKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/request/additional/capability/TargetPerformanceParametersBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/request/additional/capability/TargetPerformanceParametersBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..294f1c66c2a5429d7da9b715bc88a29cb65e5b31 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/request/additional/capability/TargetPerformanceParametersBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.request.additional.capability; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link TargetPerformanceParametersBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     TargetPerformanceParametersBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new TargetPerformanceParametersBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of TargetPerformanceParametersBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see TargetPerformanceParametersBuilder + * @see Builder + * + */ +public class TargetPerformanceParametersBuilder implements Builder { + + private String _key; + private String _value; + private TargetPerformanceParametersKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public TargetPerformanceParametersBuilder() { + } + + public TargetPerformanceParametersBuilder(TargetPerformanceParameters base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public TargetPerformanceParametersKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public TargetPerformanceParametersBuilder withKey(final TargetPerformanceParametersKey key) { + this.key = key; + return this; + } + + public TargetPerformanceParametersBuilder setKey(final String value) { + this._key = value; + return this; + } + + public TargetPerformanceParametersBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public TargetPerformanceParametersBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public TargetPerformanceParametersBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public TargetPerformanceParametersBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private TargetPerformanceParametersBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public TargetPerformanceParameters build() { + return new TargetPerformanceParametersImpl(this); + } + + private static final class TargetPerformanceParametersImpl + extends AbstractAugmentable + implements TargetPerformanceParameters { + + private final String _key; + private final String _value; + private final TargetPerformanceParametersKey key; + + TargetPerformanceParametersImpl(TargetPerformanceParametersBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new TargetPerformanceParametersKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public TargetPerformanceParametersKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!TargetPerformanceParameters.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + TargetPerformanceParameters other = (TargetPerformanceParameters)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + TargetPerformanceParametersImpl otherImpl = (TargetPerformanceParametersImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("TargetPerformanceParameters"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/request/additional/capability/TargetPerformanceParametersKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/request/additional/capability/TargetPerformanceParametersKey.java new file mode 100644 index 0000000000000000000000000000000000000000..3d7a4ecb0d3914cd2a53815ad1829d0b324d0ef9 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/request/additional/capability/TargetPerformanceParametersKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.request.additional.capability; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class TargetPerformanceParametersKey + implements Identifier { + private static final long serialVersionUID = 7896677683262255240L; + private final String _key; + + + public TargetPerformanceParametersKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public TargetPerformanceParametersKey(TargetPerformanceParametersKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof TargetPerformanceParametersKey)) { + return false; + } + final TargetPerformanceParametersKey other = (TargetPerformanceParametersKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(TargetPerformanceParametersKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/Pinning.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/Pinning.java new file mode 100644 index 0000000000000000000000000000000000000000..c2e7aba0d8726afd46dd4289a29b36ff649e3196 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/Pinning.java @@ -0,0 +1,162 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualCpu; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.pinning.Rule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.pinning.RuleKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The virtual CPU pinning configuration for the virtualised compute resource. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * container pinning {
+ *   presence "Set to specify CPU pinning.";
+ *   leaf policy {
+ *     default dynamic;
+ *     type enumeration {
+ *       enum static;
+ *       enum dynamic;
+ *     }
+ *   }
+ *   list rule {
+ *     when "../policy = 'static'";
+ *     key key;
+ *     leaf key {
+ *       type string;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-compute-desc/virtual-cpu/pinning + * + *

To create instances of this class use {@link PinningBuilder}. + * @see PinningBuilder + * + */ +public interface Pinning + extends + ChildOf, + Augmentable +{ + + + public enum Policy implements Enumeration { + Static(0, "static"), + + Dynamic(1, "dynamic") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (Policy enumItem : Policy.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private Policy(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding Policy item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding Policy item, or null if no such item exists + */ + public static Policy forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pinning"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.Pinning.class; + } + + /** + * The policy can take values of 'static' or 'dynamic'. In case of 'static' the + * virtual CPU cores are requested to be allocated to logical CPU cores according + * to the rules defined in virtualCpuPinningRules. In case of 'dynamic' the + * allocation of virtual CPU cores to logical CPU cores is decided by the VIM. + * (e.g. SMT (Simultaneous MultiThreading) requirements). + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.Pinning.Policy policy, or null if not present + */ + @Nullable Policy getPolicy(); + + /** + * A list of rules that should be considered during the allocation of the virtual + * CPUs to logical CPUs in case of 'static' virtualCpuPinningPolicy. + * + * + * + * @return java.util.Map rule, or null if not present + */ + @Nullable Map getRule(); + + /** + * @return java.util.Map rule, or an empty list if it is not present + */ + default @NonNull Map nonnullRule() { + return CodeHelpers.nonnull(getRule()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/PinningBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/PinningBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..8250f92adce15b0f58713b1cc80bed7f723495af --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/PinningBuilder.java @@ -0,0 +1,270 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.pinning.Rule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.pinning.RuleKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PinningBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PinningBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PinningBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PinningBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PinningBuilder + * @see Builder + * + */ +public class PinningBuilder implements Builder { + + private Pinning.Policy _policy; + private Map _rule; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PinningBuilder() { + } + + public PinningBuilder(Pinning base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._policy = base.getPolicy(); + this._rule = base.getRule(); + } + + + public Pinning.Policy getPolicy() { + return _policy; + } + + public Map getRule() { + return _rule; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public PinningBuilder setPolicy(final Pinning.Policy value) { + this._policy = value; + return this; + } + public PinningBuilder setRule(final Map values) { + this._rule = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setRule(Map)} instead. + */ + @Deprecated(forRemoval = true) + public PinningBuilder setRule(final List values) { + return setRule(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PinningBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PinningBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PinningBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PinningBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Pinning build() { + return new PinningImpl(this); + } + + private static final class PinningImpl + extends AbstractAugmentable + implements Pinning { + + private final Pinning.Policy _policy; + private final Map _rule; + + PinningImpl(PinningBuilder base) { + super(base.augmentation); + this._policy = base.getPolicy(); + this._rule = CodeHelpers.emptyToNull(base.getRule()); + } + + @Override + public Pinning.Policy getPolicy() { + return _policy; + } + + @Override + public Map getRule() { + return _rule; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_policy); + result = prime * result + Objects.hashCode(_rule); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Pinning.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Pinning other = (Pinning)obj; + if (!Objects.equals(_policy, other.getPolicy())) { + return false; + } + if (!Objects.equals(_rule, other.getRule())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PinningImpl otherImpl = (PinningImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Pinning"); + CodeHelpers.appendValue(helper, "_policy", _policy); + CodeHelpers.appendValue(helper, "_rule", _rule); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/VduCpuRequirements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/VduCpuRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..b6a193e342a5ebf78e3f7927e7188060914f594f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/VduCpuRequirements.java @@ -0,0 +1,67 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualCpu; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of key-value pair requirements on the compute (CPU) for the VDU. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list vdu-cpu-requirements {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-compute-desc/virtual-cpu/vdu-cpu-requirements + * + *

To create instances of this class use {@link VduCpuRequirementsBuilder}. + * @see VduCpuRequirementsBuilder + * @see VduCpuRequirementsKey + * + */ +public interface VduCpuRequirements + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vdu-cpu-requirements"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.VduCpuRequirements.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + VduCpuRequirementsKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/VduCpuRequirementsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/VduCpuRequirementsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..a48f3e0f32c0b7c76441ee61c2a6d30b8b1d31a2 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/VduCpuRequirementsBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VduCpuRequirementsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VduCpuRequirementsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VduCpuRequirementsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VduCpuRequirementsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VduCpuRequirementsBuilder + * @see Builder + * + */ +public class VduCpuRequirementsBuilder implements Builder { + + private String _key; + private String _value; + private VduCpuRequirementsKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VduCpuRequirementsBuilder() { + } + + public VduCpuRequirementsBuilder(VduCpuRequirements base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public VduCpuRequirementsKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VduCpuRequirementsBuilder withKey(final VduCpuRequirementsKey key) { + this.key = key; + return this; + } + + public VduCpuRequirementsBuilder setKey(final String value) { + this._key = value; + return this; + } + + public VduCpuRequirementsBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VduCpuRequirementsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VduCpuRequirementsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VduCpuRequirementsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VduCpuRequirementsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VduCpuRequirements build() { + return new VduCpuRequirementsImpl(this); + } + + private static final class VduCpuRequirementsImpl + extends AbstractAugmentable + implements VduCpuRequirements { + + private final String _key; + private final String _value; + private final VduCpuRequirementsKey key; + + VduCpuRequirementsImpl(VduCpuRequirementsBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VduCpuRequirementsKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public VduCpuRequirementsKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VduCpuRequirements.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VduCpuRequirements other = (VduCpuRequirements)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VduCpuRequirementsImpl otherImpl = (VduCpuRequirementsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VduCpuRequirements"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/VduCpuRequirementsKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/VduCpuRequirementsKey.java new file mode 100644 index 0000000000000000000000000000000000000000..e3fce7c83aeff0f1e90311935e66a1d17b719ee7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/VduCpuRequirementsKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VduCpuRequirementsKey + implements Identifier { + private static final long serialVersionUID = 6064457972693741496L; + private final String _key; + + + public VduCpuRequirementsKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VduCpuRequirementsKey(VduCpuRequirementsKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VduCpuRequirementsKey)) { + return false; + } + final VduCpuRequirementsKey other = (VduCpuRequirementsKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VduCpuRequirementsKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/pinning/Rule.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/pinning/Rule.java new file mode 100644 index 0000000000000000000000000000000000000000..a656898f58d35bffc2213b0d52ef1fa118d76003 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/pinning/Rule.java @@ -0,0 +1,69 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.pinning; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.Pinning; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * A list of rules that should be considered during the allocation of the virtual + * CPUs to logical CPUs in case of 'static' virtualCpuPinningPolicy. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list rule {
+ *   when "../policy = 'static'";
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-compute-desc/virtual-cpu/pinning/rule + * + *

To create instances of this class use {@link RuleBuilder}. + * @see RuleBuilder + * @see RuleKey + * + */ +public interface Rule + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("rule"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.pinning.Rule.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + RuleKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/pinning/RuleBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/pinning/RuleBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..1526ab432e7c710b3361a2480adaf3955e7f5631 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/pinning/RuleBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.pinning; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link RuleBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     RuleBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new RuleBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of RuleBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see RuleBuilder + * @see Builder + * + */ +public class RuleBuilder implements Builder { + + private String _key; + private String _value; + private RuleKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public RuleBuilder() { + } + + public RuleBuilder(Rule base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public RuleKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public RuleBuilder withKey(final RuleKey key) { + this.key = key; + return this; + } + + public RuleBuilder setKey(final String value) { + this._key = value; + return this; + } + + public RuleBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public RuleBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public RuleBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public RuleBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private RuleBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Rule build() { + return new RuleImpl(this); + } + + private static final class RuleImpl + extends AbstractAugmentable + implements Rule { + + private final String _key; + private final String _value; + private final RuleKey key; + + RuleImpl(RuleBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new RuleKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public RuleKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Rule.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Rule other = (Rule)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + RuleImpl otherImpl = (RuleImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Rule"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/pinning/RuleKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/pinning/RuleKey.java new file mode 100644 index 0000000000000000000000000000000000000000..a4f416206c574892062fcb8234f56b35b5ebe67c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/cpu/pinning/RuleKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.pinning; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class RuleKey + implements Identifier { + private static final long serialVersionUID = -7372554665194622883L; + private final String _key; + + + public RuleKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public RuleKey(RuleKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof RuleKey)) { + return false; + } + final RuleKey other = (RuleKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(RuleKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/memory/VduMemRequirements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/memory/VduMemRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..982fff3853618b6d81502dfc673ceb041aa0c791 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/memory/VduMemRequirements.java @@ -0,0 +1,67 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.memory; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualMemory; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of key-value pair requirements on the memory for the VDU. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list vdu-mem-requirements {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-compute-desc/virtual-memory/vdu-mem-requirements + * + *

To create instances of this class use {@link VduMemRequirementsBuilder}. + * @see VduMemRequirementsBuilder + * @see VduMemRequirementsKey + * + */ +public interface VduMemRequirements + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vdu-mem-requirements"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.memory.VduMemRequirements.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + VduMemRequirementsKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/memory/VduMemRequirementsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/memory/VduMemRequirementsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..b1824b9c3b98c9883cbff62869765ccbe1ff5499 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/memory/VduMemRequirementsBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.memory; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VduMemRequirementsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VduMemRequirementsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VduMemRequirementsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VduMemRequirementsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VduMemRequirementsBuilder + * @see Builder + * + */ +public class VduMemRequirementsBuilder implements Builder { + + private String _key; + private String _value; + private VduMemRequirementsKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VduMemRequirementsBuilder() { + } + + public VduMemRequirementsBuilder(VduMemRequirements base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public VduMemRequirementsKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VduMemRequirementsBuilder withKey(final VduMemRequirementsKey key) { + this.key = key; + return this; + } + + public VduMemRequirementsBuilder setKey(final String value) { + this._key = value; + return this; + } + + public VduMemRequirementsBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VduMemRequirementsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VduMemRequirementsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VduMemRequirementsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VduMemRequirementsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VduMemRequirements build() { + return new VduMemRequirementsImpl(this); + } + + private static final class VduMemRequirementsImpl + extends AbstractAugmentable + implements VduMemRequirements { + + private final String _key; + private final String _value; + private final VduMemRequirementsKey key; + + VduMemRequirementsImpl(VduMemRequirementsBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VduMemRequirementsKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public VduMemRequirementsKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VduMemRequirements.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VduMemRequirements other = (VduMemRequirements)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VduMemRequirementsImpl otherImpl = (VduMemRequirementsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VduMemRequirements"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/memory/VduMemRequirementsKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/memory/VduMemRequirementsKey.java new file mode 100644 index 0000000000000000000000000000000000000000..1abcdf65e5a4ace39b63e25825f58392a1e72cc5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/compute/desc/virtual/memory/VduMemRequirementsKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.memory; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VduMemRequirementsKey + implements Identifier { + private static final long serialVersionUID = 938784692346778508L; + private final String _key; + + + public VduMemRequirementsKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VduMemRequirementsKey(VduMemRequirementsKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VduMemRequirementsKey)) { + return false; + } + final VduMemRequirementsKey other = (VduMemRequirementsKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VduMemRequirementsKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/storage/desc/VduStorageRequirements.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/storage/desc/VduStorageRequirements.java new file mode 100644 index 0000000000000000000000000000000000000000..88f23a0751f1b2c910407535e38de66fc386b069 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/storage/desc/VduStorageRequirements.java @@ -0,0 +1,67 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.storage.desc; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDesc; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Array of key-value pairs that articulate the storage deployment requirements. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-descriptors + *

+ * list vdu-storage-requirements {
+ *   key key;
+ *   leaf key {
+ *     type string;
+ *   }
+ *   leaf value {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-descriptors/vnfd/virtual-storage-desc/vdu-storage-requirements + * + *

To create instances of this class use {@link VduStorageRequirementsBuilder}. + * @see VduStorageRequirementsBuilder + * @see VduStorageRequirementsKey + * + */ +public interface VduStorageRequirements + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vdu-storage-requirements"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.storage.desc.VduStorageRequirements.class; + } + + /** + * @return java.lang.String key, or null if not present + */ + @Nullable String getKey(); + + /** + * @return java.lang.String value, or null if not present + */ + @Nullable String getValue(); + + @Override + VduStorageRequirementsKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/storage/desc/VduStorageRequirementsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/storage/desc/VduStorageRequirementsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..5f4f4bd9ec9be3cac54071feef16892630b59e07 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/storage/desc/VduStorageRequirementsBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.storage.desc; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VduStorageRequirementsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VduStorageRequirementsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VduStorageRequirementsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VduStorageRequirementsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VduStorageRequirementsBuilder + * @see Builder + * + */ +public class VduStorageRequirementsBuilder implements Builder { + + private String _key; + private String _value; + private VduStorageRequirementsKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VduStorageRequirementsBuilder() { + } + + public VduStorageRequirementsBuilder(VduStorageRequirements base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._key = base.getKey(); + this._value = base.getValue(); + } + + + public VduStorageRequirementsKey key() { + return key; + } + + public String getKey() { + return _key; + } + + public String getValue() { + return _value; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VduStorageRequirementsBuilder withKey(final VduStorageRequirementsKey key) { + this.key = key; + return this; + } + + public VduStorageRequirementsBuilder setKey(final String value) { + this._key = value; + return this; + } + + public VduStorageRequirementsBuilder setValue(final String value) { + this._value = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VduStorageRequirementsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VduStorageRequirementsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VduStorageRequirementsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VduStorageRequirementsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VduStorageRequirements build() { + return new VduStorageRequirementsImpl(this); + } + + private static final class VduStorageRequirementsImpl + extends AbstractAugmentable + implements VduStorageRequirements { + + private final String _key; + private final String _value; + private final VduStorageRequirementsKey key; + + VduStorageRequirementsImpl(VduStorageRequirementsBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VduStorageRequirementsKey(base.getKey()); + } + this._key = key.getKey(); + this._value = base.getValue(); + } + + @Override + public VduStorageRequirementsKey key() { + return key; + } + + @Override + public String getKey() { + return _key; + } + + @Override + public String getValue() { + return _value; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VduStorageRequirements.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VduStorageRequirements other = (VduStorageRequirements)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VduStorageRequirementsImpl otherImpl = (VduStorageRequirementsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VduStorageRequirements"); + CodeHelpers.appendValue(helper, "_key", _key); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/storage/desc/VduStorageRequirementsKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/storage/desc/VduStorageRequirementsKey.java new file mode 100644 index 0000000000000000000000000000000000000000..c5944bce35bc012160b697fa309ca4e58ae3de9a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/descriptors/rev190425/vnfd/virtual/storage/desc/VduStorageRequirementsKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.storage.desc; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VduStorageRequirementsKey + implements Identifier { + private static final long serialVersionUID = 7623825622131379059L; + private final String _key; + + + public VduStorageRequirementsKey(String _key) { + + this._key = _key; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VduStorageRequirementsKey(VduStorageRequirementsKey source) { + this._key = source._key; + } + + + public String getKey() { + return _key; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_key); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VduStorageRequirementsKey)) { + return false; + } + final VduStorageRequirementsKey other = (VduStorageRequirementsKey) obj; + if (!Objects.equals(_key, other._key)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VduStorageRequirementsKey.class); + CodeHelpers.appendValue(helper, "_key", _key); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..dc5db2e056925d22074bebb59677c02cc35616bb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..755f1dfde1f8cfa920b73bafc21cf12980680405 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/$YangModuleInfoImpl.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:nfv:yang:etsi-nfv-nsd", "2019-04-25", "etsi-nfv-nsd").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/etsi-nfv-nsd@2019-04-25.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/EtsiNfvNsdData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/EtsiNfvNsdData.java new file mode 100644 index 0000000000000000000000000000000000000000..e2fbc6610e1c15bbd1f737c54efa5735c643a78a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/EtsiNfvNsdData.java @@ -0,0 +1,53 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataRoot; + +/** + * Network Services Descriptors + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-nsd + *

+ * module etsi-nfv-nsd {
+ *   yang-version 1.1;
+ *   namespace urn:etsi:nfv:yang:etsi-nfv-nsd;
+ *   prefix nsd;
+ *   import etsi-nfv-descriptors {
+ *     prefix vnf;
+ *   }
+ *   revision 2019-04-25 {
+ *   }
+ *   container nsd {
+ *     list vnfd {
+ *       key id;
+ *       uses vnf:vnfd;
+ *     }
+ *     list nsd {
+ *       key id;
+ *       max-elements 1;
+ *       uses vnf:nsd;
+ *     }
+ *     list pnfd {
+ *       key id;
+ *       uses vnf:pnfd;
+ *     }
+ *   }
+ * }
+ * 
+ * + */ +public interface EtsiNfvNsdData + extends + DataRoot +{ + + + + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.Nsd nsd, or null if not present + */ + @Nullable Nsd getNsd(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/Nsd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/Nsd.java new file mode 100644 index 0000000000000000000000000000000000000000..2d2e9f8d48e3b50f99c0ac4c049ec928a3bcf07c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/Nsd.java @@ -0,0 +1,112 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.NsdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.Pnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.PnfdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.VnfdKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-nsd + *

+ * container nsd {
+ *   list vnfd {
+ *     key id;
+ *     uses vnf:vnfd;
+ *   }
+ *   list nsd {
+ *     key id;
+ *     max-elements 1;
+ *     uses vnf:nsd;
+ *   }
+ *   list pnfd {
+ *     key id;
+ *     uses vnf:pnfd;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-nsd/nsd + * + *

To create instances of this class use {@link NsdBuilder}. + * @see NsdBuilder + * + */ +public interface Nsd + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("nsd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.Nsd.class; + } + + /** + * A VNF Descriptor (VNFD) is a deployment template which describes a VNF in terms + * of deployment and operational behaviour requirements. It also contains + * connectivity, interface and virtualised resource requirements + * + * + * + * @return java.util.Map vnfd, or null if not present + */ + @Nullable Map getVnfd(); + + /** + * @return java.util.Map vnfd, or an empty list if it is not present + */ + default @NonNull Map nonnullVnfd() { + return CodeHelpers.nonnull(getVnfd()); + } + + /** + * The NSD information element is a deployment template whose instances are used by + * the NFVO for the lifecycle management of NSs. + * + * + * + * @return java.util.Map nsd, or null if not present + */ + @Nullable Map getNsd(); + + /** + * @return java.util.Map nsd, or an empty list if it is not present + */ + default @NonNull Map nonnullNsd() { + return CodeHelpers.nonnull(getNsd()); + } + + /** + * The Pnfd information element is a deployment template enabling on-boarding PNFs + * and referencing them from an NSD. It focuses on connectivity aspects only. + * + * + * + * @return java.util.Map pnfd, or null if not present + */ + @Nullable Map getPnfd(); + + /** + * @return java.util.Map pnfd, or an empty list if it is not present + */ + default @NonNull Map nonnullPnfd() { + return CodeHelpers.nonnull(getPnfd()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/NsdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/NsdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..30fd081d2cd5389efc8b87533d56b217fa66fc7c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/NsdBuilder.java @@ -0,0 +1,330 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.NsdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.Pnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.PnfdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.VnfdKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NsdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsdBuilder + * @see Builder + * + */ +public class NsdBuilder implements Builder { + + private Map _nsd; + private Map _pnfd; + private Map _vnfd; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsdBuilder() { + } + + public NsdBuilder(Nsd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._nsd = base.getNsd(); + this._pnfd = base.getPnfd(); + this._vnfd = base.getVnfd(); + } + + + public Map getNsd() { + return _nsd; + } + + public Map getPnfd() { + return _pnfd; + } + + public Map getVnfd() { + return _vnfd; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public NsdBuilder setNsd(final Map values) { + this._nsd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setNsd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder setNsd(final List values) { + return setNsd(CodeHelpers.compatMap(values)); + } + public NsdBuilder setPnfd(final Map values) { + this._pnfd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setPnfd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder setPnfd(final List values) { + return setPnfd(CodeHelpers.compatMap(values)); + } + public NsdBuilder setVnfd(final Map values) { + this._vnfd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVnfd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder setVnfd(final List values) { + return setVnfd(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Nsd build() { + return new NsdImpl(this); + } + + private static final class NsdImpl + extends AbstractAugmentable + implements Nsd { + + private final Map _nsd; + private final Map _pnfd; + private final Map _vnfd; + + NsdImpl(NsdBuilder base) { + super(base.augmentation); + this._nsd = CodeHelpers.emptyToNull(base.getNsd()); + this._pnfd = CodeHelpers.emptyToNull(base.getPnfd()); + this._vnfd = CodeHelpers.emptyToNull(base.getVnfd()); + } + + @Override + public Map getNsd() { + return _nsd; + } + + @Override + public Map getPnfd() { + return _pnfd; + } + + @Override + public Map getVnfd() { + return _vnfd; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_nsd); + result = prime * result + Objects.hashCode(_pnfd); + result = prime * result + Objects.hashCode(_vnfd); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Nsd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Nsd other = (Nsd)obj; + if (!Objects.equals(_nsd, other.getNsd())) { + return false; + } + if (!Objects.equals(_pnfd, other.getPnfd())) { + return false; + } + if (!Objects.equals(_vnfd, other.getVnfd())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsdImpl otherImpl = (NsdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Nsd"); + CodeHelpers.appendValue(helper, "_nsd", _nsd); + CodeHelpers.appendValue(helper, "_pnfd", _pnfd); + CodeHelpers.appendValue(helper, "_vnfd", _vnfd); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/Nsd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/Nsd.java new file mode 100644 index 0000000000000000000000000000000000000000..71850d87fad065c14ca0dee62c97bbf242512357 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/Nsd.java @@ -0,0 +1,52 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The NSD information element is a deployment template whose instances are used + * the NFVO for the lifecycle management of NSs. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-nsd + *

+ * list nsd {
+ *   key id;
+ *   max-elements 1;
+ *   uses vnf:nsd;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-nsd/nsd/nsd + * + *

To create instances of this class use {@link NsdBuilder}. + * @see NsdBuilder + * @see NsdKey + * + */ +public interface Nsd + extends + ChildOf, + Augmentable, + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("nsd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.Nsd.class; + } + + @Override + NsdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/NsdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/NsdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..d143eb7a2ed33f7c8d5aefc62bc6cc09a1def11e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/NsdBuilder.java @@ -0,0 +1,773 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.DfKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.LifecycleManagementScript; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.LifecycleManagementScriptKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Sapd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.SapdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VirtualLinkDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VirtualLinkDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.Vnffgd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.VnffgdKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NsdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NsdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NsdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NsdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NsdBuilder + * @see Builder + * + */ +public class NsdBuilder implements Builder { + + private String _algorithm; + private List _autoscaleRule; + private String _certificate; + private String _designer; + private Map _df; + private String _id; + private String _invariantId; + private Map _lifecycleManagementScript; + private String _name; + private List _nestedNsdId; + private List _pnfdId; + private Map _sapd; + private String _signature; + private String _version; + private Map _virtualLinkDesc; + private List _vnfdId; + private Map _vnffgd; + private NsdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NsdBuilder() { + } + public NsdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd arg) { + this._id = arg.getId(); + this._designer = arg.getDesigner(); + this._version = arg.getVersion(); + this._name = arg.getName(); + this._invariantId = arg.getInvariantId(); + this._nestedNsdId = arg.getNestedNsdId(); + this._vnfdId = arg.getVnfdId(); + this._pnfdId = arg.getPnfdId(); + this._sapd = arg.getSapd(); + this._virtualLinkDesc = arg.getVirtualLinkDesc(); + this._vnffgd = arg.getVnffgd(); + this._autoscaleRule = arg.getAutoscaleRule(); + this._lifecycleManagementScript = arg.getLifecycleManagementScript(); + this._df = arg.getDf(); + this._signature = arg.getSignature(); + this._algorithm = arg.getAlgorithm(); + this._certificate = arg.getCertificate(); + } + public NsdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters arg) { + this._signature = arg.getSignature(); + this._algorithm = arg.getAlgorithm(); + this._certificate = arg.getCertificate(); + } + + public NsdBuilder(Nsd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._algorithm = base.getAlgorithm(); + this._autoscaleRule = base.getAutoscaleRule(); + this._certificate = base.getCertificate(); + this._designer = base.getDesigner(); + this._df = base.getDf(); + this._invariantId = base.getInvariantId(); + this._lifecycleManagementScript = base.getLifecycleManagementScript(); + this._name = base.getName(); + this._nestedNsdId = base.getNestedNsdId(); + this._pnfdId = base.getPnfdId(); + this._sapd = base.getSapd(); + this._signature = base.getSignature(); + this._version = base.getVersion(); + this._virtualLinkDesc = base.getVirtualLinkDesc(); + this._vnfdId = base.getVnfdId(); + this._vnffgd = base.getVnffgd(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd) { + this._id = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getId(); + this._designer = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getDesigner(); + this._version = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getVersion(); + this._name = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getName(); + this._invariantId = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getInvariantId(); + this._nestedNsdId = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getNestedNsdId(); + this._vnfdId = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getVnfdId(); + this._pnfdId = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getPnfdId(); + this._sapd = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getSapd(); + this._virtualLinkDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getVirtualLinkDesc(); + this._vnffgd = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getVnffgd(); + this._autoscaleRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getAutoscaleRule(); + this._lifecycleManagementScript = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getLifecycleManagementScript(); + this._df = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd)arg).getDf(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters) { + this._signature = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getSignature(); + this._algorithm = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getAlgorithm(); + this._certificate = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters)arg).getCertificate(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Nsd, org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityParameters]"); + } + + public NsdKey key() { + return key; + } + + public String getAlgorithm() { + return _algorithm; + } + + public List getAutoscaleRule() { + return _autoscaleRule; + } + + public String getCertificate() { + return _certificate; + } + + public String getDesigner() { + return _designer; + } + + public Map getDf() { + return _df; + } + + public String getId() { + return _id; + } + + public String getInvariantId() { + return _invariantId; + } + + public Map getLifecycleManagementScript() { + return _lifecycleManagementScript; + } + + public String getName() { + return _name; + } + + public List getNestedNsdId() { + return _nestedNsdId; + } + + public List getPnfdId() { + return _pnfdId; + } + + public Map getSapd() { + return _sapd; + } + + public String getSignature() { + return _signature; + } + + public String getVersion() { + return _version; + } + + public Map getVirtualLinkDesc() { + return _virtualLinkDesc; + } + + public List getVnfdId() { + return _vnfdId; + } + + public Map getVnffgd() { + return _vnffgd; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public NsdBuilder withKey(final NsdKey key) { + this.key = key; + return this; + } + + public NsdBuilder setAlgorithm(final String value) { + this._algorithm = value; + return this; + } + public NsdBuilder setAutoscaleRule(final List values) { + this._autoscaleRule = values; + return this; + } + + + public NsdBuilder setCertificate(final String value) { + this._certificate = value; + return this; + } + + public NsdBuilder setDesigner(final String value) { + this._designer = value; + return this; + } + public NsdBuilder setDf(final Map values) { + this._df = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setDf(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder setDf(final List values) { + return setDf(CodeHelpers.compatMap(values)); + } + + public NsdBuilder setId(final String value) { + this._id = value; + return this; + } + + public NsdBuilder setInvariantId(final String value) { + this._invariantId = value; + return this; + } + public NsdBuilder setLifecycleManagementScript(final Map values) { + this._lifecycleManagementScript = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setLifecycleManagementScript(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder setLifecycleManagementScript(final List values) { + return setLifecycleManagementScript(CodeHelpers.compatMap(values)); + } + + public NsdBuilder setName(final String value) { + this._name = value; + return this; + } + public NsdBuilder setNestedNsdId(final List values) { + this._nestedNsdId = values; + return this; + } + + public NsdBuilder setPnfdId(final List values) { + this._pnfdId = values; + return this; + } + + public NsdBuilder setSapd(final Map values) { + this._sapd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSapd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder setSapd(final List values) { + return setSapd(CodeHelpers.compatMap(values)); + } + + public NsdBuilder setSignature(final String value) { + this._signature = value; + return this; + } + + public NsdBuilder setVersion(final String value) { + this._version = value; + return this; + } + public NsdBuilder setVirtualLinkDesc(final Map values) { + this._virtualLinkDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualLinkDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder setVirtualLinkDesc(final List values) { + return setVirtualLinkDesc(CodeHelpers.compatMap(values)); + } + public NsdBuilder setVnfdId(final List values) { + this._vnfdId = values; + return this; + } + + public NsdBuilder setVnffgd(final Map values) { + this._vnffgd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVnffgd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder setVnffgd(final List values) { + return setVnffgd(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NsdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NsdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NsdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NsdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Nsd build() { + return new NsdImpl(this); + } + + private static final class NsdImpl + extends AbstractAugmentable + implements Nsd { + + private final String _algorithm; + private final List _autoscaleRule; + private final String _certificate; + private final String _designer; + private final Map _df; + private final String _id; + private final String _invariantId; + private final Map _lifecycleManagementScript; + private final String _name; + private final List _nestedNsdId; + private final List _pnfdId; + private final Map _sapd; + private final String _signature; + private final String _version; + private final Map _virtualLinkDesc; + private final List _vnfdId; + private final Map _vnffgd; + private final NsdKey key; + + NsdImpl(NsdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new NsdKey(base.getId()); + } + this._id = key.getId(); + this._algorithm = base.getAlgorithm(); + this._autoscaleRule = base.getAutoscaleRule(); + this._certificate = base.getCertificate(); + this._designer = base.getDesigner(); + this._df = CodeHelpers.emptyToNull(base.getDf()); + this._invariantId = base.getInvariantId(); + this._lifecycleManagementScript = CodeHelpers.emptyToNull(base.getLifecycleManagementScript()); + this._name = base.getName(); + this._nestedNsdId = base.getNestedNsdId(); + this._pnfdId = base.getPnfdId(); + this._sapd = CodeHelpers.emptyToNull(base.getSapd()); + this._signature = base.getSignature(); + this._version = base.getVersion(); + this._virtualLinkDesc = CodeHelpers.emptyToNull(base.getVirtualLinkDesc()); + this._vnfdId = base.getVnfdId(); + this._vnffgd = CodeHelpers.emptyToNull(base.getVnffgd()); + } + + @Override + public NsdKey key() { + return key; + } + + @Override + public String getAlgorithm() { + return _algorithm; + } + + @Override + public List getAutoscaleRule() { + return _autoscaleRule; + } + + @Override + public String getCertificate() { + return _certificate; + } + + @Override + public String getDesigner() { + return _designer; + } + + @Override + public Map getDf() { + return _df; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getInvariantId() { + return _invariantId; + } + + @Override + public Map getLifecycleManagementScript() { + return _lifecycleManagementScript; + } + + @Override + public String getName() { + return _name; + } + + @Override + public List getNestedNsdId() { + return _nestedNsdId; + } + + @Override + public List getPnfdId() { + return _pnfdId; + } + + @Override + public Map getSapd() { + return _sapd; + } + + @Override + public String getSignature() { + return _signature; + } + + @Override + public String getVersion() { + return _version; + } + + @Override + public Map getVirtualLinkDesc() { + return _virtualLinkDesc; + } + + @Override + public List getVnfdId() { + return _vnfdId; + } + + @Override + public Map getVnffgd() { + return _vnffgd; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_algorithm); + result = prime * result + Objects.hashCode(_autoscaleRule); + result = prime * result + Objects.hashCode(_certificate); + result = prime * result + Objects.hashCode(_designer); + result = prime * result + Objects.hashCode(_df); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_invariantId); + result = prime * result + Objects.hashCode(_lifecycleManagementScript); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_nestedNsdId); + result = prime * result + Objects.hashCode(_pnfdId); + result = prime * result + Objects.hashCode(_sapd); + result = prime * result + Objects.hashCode(_signature); + result = prime * result + Objects.hashCode(_version); + result = prime * result + Objects.hashCode(_virtualLinkDesc); + result = prime * result + Objects.hashCode(_vnfdId); + result = prime * result + Objects.hashCode(_vnffgd); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Nsd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Nsd other = (Nsd)obj; + if (!Objects.equals(_algorithm, other.getAlgorithm())) { + return false; + } + if (!Objects.equals(_autoscaleRule, other.getAutoscaleRule())) { + return false; + } + if (!Objects.equals(_certificate, other.getCertificate())) { + return false; + } + if (!Objects.equals(_designer, other.getDesigner())) { + return false; + } + if (!Objects.equals(_df, other.getDf())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_invariantId, other.getInvariantId())) { + return false; + } + if (!Objects.equals(_lifecycleManagementScript, other.getLifecycleManagementScript())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_nestedNsdId, other.getNestedNsdId())) { + return false; + } + if (!Objects.equals(_pnfdId, other.getPnfdId())) { + return false; + } + if (!Objects.equals(_sapd, other.getSapd())) { + return false; + } + if (!Objects.equals(_signature, other.getSignature())) { + return false; + } + if (!Objects.equals(_version, other.getVersion())) { + return false; + } + if (!Objects.equals(_virtualLinkDesc, other.getVirtualLinkDesc())) { + return false; + } + if (!Objects.equals(_vnfdId, other.getVnfdId())) { + return false; + } + if (!Objects.equals(_vnffgd, other.getVnffgd())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NsdImpl otherImpl = (NsdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Nsd"); + CodeHelpers.appendValue(helper, "_algorithm", _algorithm); + CodeHelpers.appendValue(helper, "_autoscaleRule", _autoscaleRule); + CodeHelpers.appendValue(helper, "_certificate", _certificate); + CodeHelpers.appendValue(helper, "_designer", _designer); + CodeHelpers.appendValue(helper, "_df", _df); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_invariantId", _invariantId); + CodeHelpers.appendValue(helper, "_lifecycleManagementScript", _lifecycleManagementScript); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_nestedNsdId", _nestedNsdId); + CodeHelpers.appendValue(helper, "_pnfdId", _pnfdId); + CodeHelpers.appendValue(helper, "_sapd", _sapd); + CodeHelpers.appendValue(helper, "_signature", _signature); + CodeHelpers.appendValue(helper, "_version", _version); + CodeHelpers.appendValue(helper, "_virtualLinkDesc", _virtualLinkDesc); + CodeHelpers.appendValue(helper, "_vnfdId", _vnfdId); + CodeHelpers.appendValue(helper, "_vnffgd", _vnffgd); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/NsdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/NsdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..2bc0942b2078ced9eecea973f17aac53faf2a438 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/NsdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class NsdKey + implements Identifier { + private static final long serialVersionUID = 8060294317279421094L; + private final String _id; + + + public NsdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public NsdKey(NsdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof NsdKey)) { + return false; + } + final NsdKey other = (NsdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(NsdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/Pnfd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/Pnfd.java new file mode 100644 index 0000000000000000000000000000000000000000..eda7d980078d9eb3845ce72210f2bae15d632fc5 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/Pnfd.java @@ -0,0 +1,52 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.Nsd; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * The Pnfd information element is a deployment template enabling on-boarding PNFs + * and referencing them from an NSD. It focuses on connectivity aspects only. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-nsd + *

+ * list pnfd {
+ *   key id;
+ *   uses vnf:pnfd;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-nsd/nsd/pnfd + * + *

To create instances of this class use {@link PnfdBuilder}. + * @see PnfdBuilder + * @see PnfdKey + * + */ +public interface Pnfd + extends + ChildOf, + Augmentable, + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pnfd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.Pnfd.class; + } + + @Override + PnfdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/PnfdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/PnfdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..9166d77bda46e21a120ff0bb2ad91519a9475197 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/PnfdBuilder.java @@ -0,0 +1,558 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.ExtCpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.ExtCpdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.Security; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.SecurityKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRuleKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PnfdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PnfdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PnfdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PnfdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PnfdBuilder + * @see Builder + * + */ +public class PnfdBuilder implements Builder { + + private Map _extCpd; + private String _functionDescription; + private String _geographicalLocationInfo; + private String _id; + private String _invariantId; + private String _name; + private String _provider; + private Map _security; + private Map _securityGroupRule; + private String _version; + private PnfdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PnfdBuilder() { + } + public PnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd arg) { + this._id = arg.getId(); + this._functionDescription = arg.getFunctionDescription(); + this._provider = arg.getProvider(); + this._version = arg.getVersion(); + this._invariantId = arg.getInvariantId(); + this._name = arg.getName(); + this._extCpd = arg.getExtCpd(); + this._security = arg.getSecurity(); + this._geographicalLocationInfo = arg.getGeographicalLocationInfo(); + this._securityGroupRule = arg.getSecurityGroupRule(); + } + public PnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule arg) { + this._securityGroupRule = arg.getSecurityGroupRule(); + } + + public PnfdBuilder(Pnfd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._extCpd = base.getExtCpd(); + this._functionDescription = base.getFunctionDescription(); + this._geographicalLocationInfo = base.getGeographicalLocationInfo(); + this._invariantId = base.getInvariantId(); + this._name = base.getName(); + this._provider = base.getProvider(); + this._security = base.getSecurity(); + this._securityGroupRule = base.getSecurityGroupRule(); + this._version = base.getVersion(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule) { + this._securityGroupRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule)arg).getSecurityGroupRule(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd) { + this._id = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getId(); + this._functionDescription = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getFunctionDescription(); + this._provider = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getProvider(); + this._version = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getVersion(); + this._invariantId = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getInvariantId(); + this._name = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getName(); + this._extCpd = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getExtCpd(); + this._security = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getSecurity(); + this._geographicalLocationInfo = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getGeographicalLocationInfo(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule, org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd]"); + } + + public PnfdKey key() { + return key; + } + + public Map getExtCpd() { + return _extCpd; + } + + public String getFunctionDescription() { + return _functionDescription; + } + + public String getGeographicalLocationInfo() { + return _geographicalLocationInfo; + } + + public String getId() { + return _id; + } + + public String getInvariantId() { + return _invariantId; + } + + public String getName() { + return _name; + } + + public String getProvider() { + return _provider; + } + + public Map getSecurity() { + return _security; + } + + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + public String getVersion() { + return _version; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public PnfdBuilder withKey(final PnfdKey key) { + this.key = key; + return this; + } + public PnfdBuilder setExtCpd(final Map values) { + this._extCpd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setExtCpd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public PnfdBuilder setExtCpd(final List values) { + return setExtCpd(CodeHelpers.compatMap(values)); + } + + public PnfdBuilder setFunctionDescription(final String value) { + this._functionDescription = value; + return this; + } + + public PnfdBuilder setGeographicalLocationInfo(final String value) { + this._geographicalLocationInfo = value; + return this; + } + + public PnfdBuilder setId(final String value) { + this._id = value; + return this; + } + + public PnfdBuilder setInvariantId(final String value) { + this._invariantId = value; + return this; + } + + public PnfdBuilder setName(final String value) { + this._name = value; + return this; + } + + public PnfdBuilder setProvider(final String value) { + this._provider = value; + return this; + } + public PnfdBuilder setSecurity(final Map values) { + this._security = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSecurity(Map)} instead. + */ + @Deprecated(forRemoval = true) + public PnfdBuilder setSecurity(final List values) { + return setSecurity(CodeHelpers.compatMap(values)); + } + public PnfdBuilder setSecurityGroupRule(final Map values) { + this._securityGroupRule = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSecurityGroupRule(Map)} instead. + */ + @Deprecated(forRemoval = true) + public PnfdBuilder setSecurityGroupRule(final List values) { + return setSecurityGroupRule(CodeHelpers.compatMap(values)); + } + + public PnfdBuilder setVersion(final String value) { + this._version = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PnfdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PnfdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PnfdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PnfdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Pnfd build() { + return new PnfdImpl(this); + } + + private static final class PnfdImpl + extends AbstractAugmentable + implements Pnfd { + + private final Map _extCpd; + private final String _functionDescription; + private final String _geographicalLocationInfo; + private final String _id; + private final String _invariantId; + private final String _name; + private final String _provider; + private final Map _security; + private final Map _securityGroupRule; + private final String _version; + private final PnfdKey key; + + PnfdImpl(PnfdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new PnfdKey(base.getId()); + } + this._id = key.getId(); + this._extCpd = CodeHelpers.emptyToNull(base.getExtCpd()); + this._functionDescription = base.getFunctionDescription(); + this._geographicalLocationInfo = base.getGeographicalLocationInfo(); + this._invariantId = base.getInvariantId(); + this._name = base.getName(); + this._provider = base.getProvider(); + this._security = CodeHelpers.emptyToNull(base.getSecurity()); + this._securityGroupRule = CodeHelpers.emptyToNull(base.getSecurityGroupRule()); + this._version = base.getVersion(); + } + + @Override + public PnfdKey key() { + return key; + } + + @Override + public Map getExtCpd() { + return _extCpd; + } + + @Override + public String getFunctionDescription() { + return _functionDescription; + } + + @Override + public String getGeographicalLocationInfo() { + return _geographicalLocationInfo; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getInvariantId() { + return _invariantId; + } + + @Override + public String getName() { + return _name; + } + + @Override + public String getProvider() { + return _provider; + } + + @Override + public Map getSecurity() { + return _security; + } + + @Override + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + @Override + public String getVersion() { + return _version; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_extCpd); + result = prime * result + Objects.hashCode(_functionDescription); + result = prime * result + Objects.hashCode(_geographicalLocationInfo); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_invariantId); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_provider); + result = prime * result + Objects.hashCode(_security); + result = prime * result + Objects.hashCode(_securityGroupRule); + result = prime * result + Objects.hashCode(_version); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Pnfd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Pnfd other = (Pnfd)obj; + if (!Objects.equals(_extCpd, other.getExtCpd())) { + return false; + } + if (!Objects.equals(_functionDescription, other.getFunctionDescription())) { + return false; + } + if (!Objects.equals(_geographicalLocationInfo, other.getGeographicalLocationInfo())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_invariantId, other.getInvariantId())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_provider, other.getProvider())) { + return false; + } + if (!Objects.equals(_security, other.getSecurity())) { + return false; + } + if (!Objects.equals(_securityGroupRule, other.getSecurityGroupRule())) { + return false; + } + if (!Objects.equals(_version, other.getVersion())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PnfdImpl otherImpl = (PnfdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Pnfd"); + CodeHelpers.appendValue(helper, "_extCpd", _extCpd); + CodeHelpers.appendValue(helper, "_functionDescription", _functionDescription); + CodeHelpers.appendValue(helper, "_geographicalLocationInfo", _geographicalLocationInfo); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_invariantId", _invariantId); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_provider", _provider); + CodeHelpers.appendValue(helper, "_security", _security); + CodeHelpers.appendValue(helper, "_securityGroupRule", _securityGroupRule); + CodeHelpers.appendValue(helper, "_version", _version); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/PnfdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/PnfdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..5e15098728d285a753073871863728fad85348c1 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/PnfdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class PnfdKey + implements Identifier { + private static final long serialVersionUID = -6839690951618085740L; + private final String _id; + + + public PnfdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public PnfdKey(PnfdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof PnfdKey)) { + return false; + } + final PnfdKey other = (PnfdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(PnfdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/Vnfd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/Vnfd.java new file mode 100644 index 0000000000000000000000000000000000000000..58d3c9585287a50ba163536ce0147c066ab42546 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/Vnfd.java @@ -0,0 +1,53 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.Nsd; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * A VNF Descriptor (VNFD) is a deployment template which describes a VNF in terms + * of deployment and operational behaviour requirements. It also contains + * connectivity, interface and virtualised resource requirements + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-nsd + *

+ * list vnfd {
+ *   key id;
+ *   uses vnf:vnfd;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-nsd/nsd/vnfd + * + *

To create instances of this class use {@link VnfdBuilder}. + * @see VnfdBuilder + * @see VnfdKey + * + */ +public interface Vnfd + extends + ChildOf, + Augmentable, + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnfd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd.Vnfd.class; + } + + @Override + VnfdKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/VnfdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/VnfdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..96fd5926a0a76d097d0b48263977dbe29cc96725 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/VnfdBuilder.java @@ -0,0 +1,1062 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRuleKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ConfigurableProperties; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.DfKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ElementGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ElementGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ExtCpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ExtCpdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Indicator; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IndicatorKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IntVirtualLinkDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IntVirtualLinkDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.LifecycleManagementScript; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.LifecycleManagementScriptKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ModifiableAttributes; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VduKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDescKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VnfdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfdBuilder + * @see Builder + * + */ +public class VnfdBuilder implements Builder { + + private List _autoScale; + private ConfigurableProperties _configurableProperties; + private String _defaultLocalizationLanguage; + private Map _df; + private Map _elementGroup; + private Map _extCpd; + private String _id; + private Map _indicator; + private Map _intVirtualLinkDesc; + private Map _lifecycleManagementScript; + private String _localizationLanguage; + private ModifiableAttributes _modifiableAttributes; + private String _productInfoDescription; + private String _productInfoName; + private String _productName; + private String _provider; + private Map _securityGroupRule; + private String _softwareVersion; + private Map _swImageDesc; + private Map _vdu; + private String _version; + private Map _virtualComputeDesc; + private Map _virtualStorageDesc; + private List _vnfmInfo; + private VnfdKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfdBuilder() { + } + public VnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd arg) { + this._id = arg.getId(); + this._provider = arg.getProvider(); + this._productName = arg.getProductName(); + this._softwareVersion = arg.getSoftwareVersion(); + this._version = arg.getVersion(); + this._productInfoName = arg.getProductInfoName(); + this._productInfoDescription = arg.getProductInfoDescription(); + this._vnfmInfo = arg.getVnfmInfo(); + this._localizationLanguage = arg.getLocalizationLanguage(); + this._defaultLocalizationLanguage = arg.getDefaultLocalizationLanguage(); + this._vdu = arg.getVdu(); + this._virtualComputeDesc = arg.getVirtualComputeDesc(); + this._virtualStorageDesc = arg.getVirtualStorageDesc(); + this._swImageDesc = arg.getSwImageDesc(); + this._intVirtualLinkDesc = arg.getIntVirtualLinkDesc(); + this._extCpd = arg.getExtCpd(); + this._df = arg.getDf(); + this._configurableProperties = arg.getConfigurableProperties(); + this._modifiableAttributes = arg.getModifiableAttributes(); + this._lifecycleManagementScript = arg.getLifecycleManagementScript(); + this._elementGroup = arg.getElementGroup(); + this._indicator = arg.getIndicator(); + this._autoScale = arg.getAutoScale(); + this._securityGroupRule = arg.getSecurityGroupRule(); + } + public VnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule arg) { + this._securityGroupRule = arg.getSecurityGroupRule(); + } + + public VnfdBuilder(Vnfd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._autoScale = base.getAutoScale(); + this._configurableProperties = base.getConfigurableProperties(); + this._defaultLocalizationLanguage = base.getDefaultLocalizationLanguage(); + this._df = base.getDf(); + this._elementGroup = base.getElementGroup(); + this._extCpd = base.getExtCpd(); + this._indicator = base.getIndicator(); + this._intVirtualLinkDesc = base.getIntVirtualLinkDesc(); + this._lifecycleManagementScript = base.getLifecycleManagementScript(); + this._localizationLanguage = base.getLocalizationLanguage(); + this._modifiableAttributes = base.getModifiableAttributes(); + this._productInfoDescription = base.getProductInfoDescription(); + this._productInfoName = base.getProductInfoName(); + this._productName = base.getProductName(); + this._provider = base.getProvider(); + this._securityGroupRule = base.getSecurityGroupRule(); + this._softwareVersion = base.getSoftwareVersion(); + this._swImageDesc = base.getSwImageDesc(); + this._vdu = base.getVdu(); + this._version = base.getVersion(); + this._virtualComputeDesc = base.getVirtualComputeDesc(); + this._virtualStorageDesc = base.getVirtualStorageDesc(); + this._vnfmInfo = base.getVnfmInfo(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule) { + this._securityGroupRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule)arg).getSecurityGroupRule(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd) { + this._id = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getId(); + this._provider = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProvider(); + this._productName = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProductName(); + this._softwareVersion = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getSoftwareVersion(); + this._version = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVersion(); + this._productInfoName = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProductInfoName(); + this._productInfoDescription = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProductInfoDescription(); + this._vnfmInfo = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVnfmInfo(); + this._localizationLanguage = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getLocalizationLanguage(); + this._defaultLocalizationLanguage = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getDefaultLocalizationLanguage(); + this._vdu = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVdu(); + this._virtualComputeDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVirtualComputeDesc(); + this._virtualStorageDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVirtualStorageDesc(); + this._swImageDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getSwImageDesc(); + this._intVirtualLinkDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getIntVirtualLinkDesc(); + this._extCpd = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getExtCpd(); + this._df = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getDf(); + this._configurableProperties = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getConfigurableProperties(); + this._modifiableAttributes = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getModifiableAttributes(); + this._lifecycleManagementScript = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getLifecycleManagementScript(); + this._elementGroup = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getElementGroup(); + this._indicator = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getIndicator(); + this._autoScale = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getAutoScale(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule, org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd]"); + } + + public VnfdKey key() { + return key; + } + + public List getAutoScale() { + return _autoScale; + } + + public ConfigurableProperties getConfigurableProperties() { + return _configurableProperties; + } + + public String getDefaultLocalizationLanguage() { + return _defaultLocalizationLanguage; + } + + public Map getDf() { + return _df; + } + + public Map getElementGroup() { + return _elementGroup; + } + + public Map getExtCpd() { + return _extCpd; + } + + public String getId() { + return _id; + } + + public Map getIndicator() { + return _indicator; + } + + public Map getIntVirtualLinkDesc() { + return _intVirtualLinkDesc; + } + + public Map getLifecycleManagementScript() { + return _lifecycleManagementScript; + } + + public String getLocalizationLanguage() { + return _localizationLanguage; + } + + public ModifiableAttributes getModifiableAttributes() { + return _modifiableAttributes; + } + + public String getProductInfoDescription() { + return _productInfoDescription; + } + + public String getProductInfoName() { + return _productInfoName; + } + + public String getProductName() { + return _productName; + } + + public String getProvider() { + return _provider; + } + + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + public String getSoftwareVersion() { + return _softwareVersion; + } + + public Map getSwImageDesc() { + return _swImageDesc; + } + + public Map getVdu() { + return _vdu; + } + + public String getVersion() { + return _version; + } + + public Map getVirtualComputeDesc() { + return _virtualComputeDesc; + } + + public Map getVirtualStorageDesc() { + return _virtualStorageDesc; + } + + public List getVnfmInfo() { + return _vnfmInfo; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VnfdBuilder withKey(final VnfdKey key) { + this.key = key; + return this; + } + public VnfdBuilder setAutoScale(final List values) { + this._autoScale = values; + return this; + } + + + public VnfdBuilder setConfigurableProperties(final ConfigurableProperties value) { + this._configurableProperties = value; + return this; + } + + public VnfdBuilder setDefaultLocalizationLanguage(final String value) { + this._defaultLocalizationLanguage = value; + return this; + } + public VnfdBuilder setDf(final Map values) { + this._df = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setDf(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setDf(final List values) { + return setDf(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setElementGroup(final Map values) { + this._elementGroup = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setElementGroup(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setElementGroup(final List values) { + return setElementGroup(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setExtCpd(final Map values) { + this._extCpd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setExtCpd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setExtCpd(final List values) { + return setExtCpd(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setId(final String value) { + this._id = value; + return this; + } + public VnfdBuilder setIndicator(final Map values) { + this._indicator = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setIndicator(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setIndicator(final List values) { + return setIndicator(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setIntVirtualLinkDesc(final Map values) { + this._intVirtualLinkDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setIntVirtualLinkDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setIntVirtualLinkDesc(final List values) { + return setIntVirtualLinkDesc(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setLifecycleManagementScript(final Map values) { + this._lifecycleManagementScript = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setLifecycleManagementScript(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setLifecycleManagementScript(final List values) { + return setLifecycleManagementScript(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setLocalizationLanguage(final String value) { + this._localizationLanguage = value; + return this; + } + + public VnfdBuilder setModifiableAttributes(final ModifiableAttributes value) { + this._modifiableAttributes = value; + return this; + } + + public VnfdBuilder setProductInfoDescription(final String value) { + this._productInfoDescription = value; + return this; + } + + public VnfdBuilder setProductInfoName(final String value) { + this._productInfoName = value; + return this; + } + + public VnfdBuilder setProductName(final String value) { + this._productName = value; + return this; + } + + public VnfdBuilder setProvider(final String value) { + this._provider = value; + return this; + } + public VnfdBuilder setSecurityGroupRule(final Map values) { + this._securityGroupRule = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSecurityGroupRule(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setSecurityGroupRule(final List values) { + return setSecurityGroupRule(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setSoftwareVersion(final String value) { + this._softwareVersion = value; + return this; + } + public VnfdBuilder setSwImageDesc(final Map values) { + this._swImageDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSwImageDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setSwImageDesc(final List values) { + return setSwImageDesc(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setVdu(final Map values) { + this._vdu = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVdu(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setVdu(final List values) { + return setVdu(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setVersion(final String value) { + this._version = value; + return this; + } + public VnfdBuilder setVirtualComputeDesc(final Map values) { + this._virtualComputeDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualComputeDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setVirtualComputeDesc(final List values) { + return setVirtualComputeDesc(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setVirtualStorageDesc(final Map values) { + this._virtualStorageDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualStorageDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setVirtualStorageDesc(final List values) { + return setVirtualStorageDesc(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setVnfmInfo(final List values) { + this._vnfmInfo = values; + return this; + } + + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Vnfd build() { + return new VnfdImpl(this); + } + + private static final class VnfdImpl + extends AbstractAugmentable + implements Vnfd { + + private final List _autoScale; + private final ConfigurableProperties _configurableProperties; + private final String _defaultLocalizationLanguage; + private final Map _df; + private final Map _elementGroup; + private final Map _extCpd; + private final String _id; + private final Map _indicator; + private final Map _intVirtualLinkDesc; + private final Map _lifecycleManagementScript; + private final String _localizationLanguage; + private final ModifiableAttributes _modifiableAttributes; + private final String _productInfoDescription; + private final String _productInfoName; + private final String _productName; + private final String _provider; + private final Map _securityGroupRule; + private final String _softwareVersion; + private final Map _swImageDesc; + private final Map _vdu; + private final String _version; + private final Map _virtualComputeDesc; + private final Map _virtualStorageDesc; + private final List _vnfmInfo; + private final VnfdKey key; + + VnfdImpl(VnfdBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VnfdKey(base.getId()); + } + this._id = key.getId(); + this._autoScale = base.getAutoScale(); + this._configurableProperties = base.getConfigurableProperties(); + this._defaultLocalizationLanguage = base.getDefaultLocalizationLanguage(); + this._df = CodeHelpers.emptyToNull(base.getDf()); + this._elementGroup = CodeHelpers.emptyToNull(base.getElementGroup()); + this._extCpd = CodeHelpers.emptyToNull(base.getExtCpd()); + this._indicator = CodeHelpers.emptyToNull(base.getIndicator()); + this._intVirtualLinkDesc = CodeHelpers.emptyToNull(base.getIntVirtualLinkDesc()); + this._lifecycleManagementScript = CodeHelpers.emptyToNull(base.getLifecycleManagementScript()); + this._localizationLanguage = base.getLocalizationLanguage(); + this._modifiableAttributes = base.getModifiableAttributes(); + this._productInfoDescription = base.getProductInfoDescription(); + this._productInfoName = base.getProductInfoName(); + this._productName = base.getProductName(); + this._provider = base.getProvider(); + this._securityGroupRule = CodeHelpers.emptyToNull(base.getSecurityGroupRule()); + this._softwareVersion = base.getSoftwareVersion(); + this._swImageDesc = CodeHelpers.emptyToNull(base.getSwImageDesc()); + this._vdu = CodeHelpers.emptyToNull(base.getVdu()); + this._version = base.getVersion(); + this._virtualComputeDesc = CodeHelpers.emptyToNull(base.getVirtualComputeDesc()); + this._virtualStorageDesc = CodeHelpers.emptyToNull(base.getVirtualStorageDesc()); + this._vnfmInfo = base.getVnfmInfo(); + } + + @Override + public VnfdKey key() { + return key; + } + + @Override + public List getAutoScale() { + return _autoScale; + } + + @Override + public ConfigurableProperties getConfigurableProperties() { + return _configurableProperties; + } + + @Override + public String getDefaultLocalizationLanguage() { + return _defaultLocalizationLanguage; + } + + @Override + public Map getDf() { + return _df; + } + + @Override + public Map getElementGroup() { + return _elementGroup; + } + + @Override + public Map getExtCpd() { + return _extCpd; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getIndicator() { + return _indicator; + } + + @Override + public Map getIntVirtualLinkDesc() { + return _intVirtualLinkDesc; + } + + @Override + public Map getLifecycleManagementScript() { + return _lifecycleManagementScript; + } + + @Override + public String getLocalizationLanguage() { + return _localizationLanguage; + } + + @Override + public ModifiableAttributes getModifiableAttributes() { + return _modifiableAttributes; + } + + @Override + public String getProductInfoDescription() { + return _productInfoDescription; + } + + @Override + public String getProductInfoName() { + return _productInfoName; + } + + @Override + public String getProductName() { + return _productName; + } + + @Override + public String getProvider() { + return _provider; + } + + @Override + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + @Override + public String getSoftwareVersion() { + return _softwareVersion; + } + + @Override + public Map getSwImageDesc() { + return _swImageDesc; + } + + @Override + public Map getVdu() { + return _vdu; + } + + @Override + public String getVersion() { + return _version; + } + + @Override + public Map getVirtualComputeDesc() { + return _virtualComputeDesc; + } + + @Override + public Map getVirtualStorageDesc() { + return _virtualStorageDesc; + } + + @Override + public List getVnfmInfo() { + return _vnfmInfo; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_autoScale); + result = prime * result + Objects.hashCode(_configurableProperties); + result = prime * result + Objects.hashCode(_defaultLocalizationLanguage); + result = prime * result + Objects.hashCode(_df); + result = prime * result + Objects.hashCode(_elementGroup); + result = prime * result + Objects.hashCode(_extCpd); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_indicator); + result = prime * result + Objects.hashCode(_intVirtualLinkDesc); + result = prime * result + Objects.hashCode(_lifecycleManagementScript); + result = prime * result + Objects.hashCode(_localizationLanguage); + result = prime * result + Objects.hashCode(_modifiableAttributes); + result = prime * result + Objects.hashCode(_productInfoDescription); + result = prime * result + Objects.hashCode(_productInfoName); + result = prime * result + Objects.hashCode(_productName); + result = prime * result + Objects.hashCode(_provider); + result = prime * result + Objects.hashCode(_securityGroupRule); + result = prime * result + Objects.hashCode(_softwareVersion); + result = prime * result + Objects.hashCode(_swImageDesc); + result = prime * result + Objects.hashCode(_vdu); + result = prime * result + Objects.hashCode(_version); + result = prime * result + Objects.hashCode(_virtualComputeDesc); + result = prime * result + Objects.hashCode(_virtualStorageDesc); + result = prime * result + Objects.hashCode(_vnfmInfo); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vnfd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vnfd other = (Vnfd)obj; + if (!Objects.equals(_autoScale, other.getAutoScale())) { + return false; + } + if (!Objects.equals(_configurableProperties, other.getConfigurableProperties())) { + return false; + } + if (!Objects.equals(_defaultLocalizationLanguage, other.getDefaultLocalizationLanguage())) { + return false; + } + if (!Objects.equals(_df, other.getDf())) { + return false; + } + if (!Objects.equals(_elementGroup, other.getElementGroup())) { + return false; + } + if (!Objects.equals(_extCpd, other.getExtCpd())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_indicator, other.getIndicator())) { + return false; + } + if (!Objects.equals(_intVirtualLinkDesc, other.getIntVirtualLinkDesc())) { + return false; + } + if (!Objects.equals(_lifecycleManagementScript, other.getLifecycleManagementScript())) { + return false; + } + if (!Objects.equals(_localizationLanguage, other.getLocalizationLanguage())) { + return false; + } + if (!Objects.equals(_modifiableAttributes, other.getModifiableAttributes())) { + return false; + } + if (!Objects.equals(_productInfoDescription, other.getProductInfoDescription())) { + return false; + } + if (!Objects.equals(_productInfoName, other.getProductInfoName())) { + return false; + } + if (!Objects.equals(_productName, other.getProductName())) { + return false; + } + if (!Objects.equals(_provider, other.getProvider())) { + return false; + } + if (!Objects.equals(_securityGroupRule, other.getSecurityGroupRule())) { + return false; + } + if (!Objects.equals(_softwareVersion, other.getSoftwareVersion())) { + return false; + } + if (!Objects.equals(_swImageDesc, other.getSwImageDesc())) { + return false; + } + if (!Objects.equals(_vdu, other.getVdu())) { + return false; + } + if (!Objects.equals(_version, other.getVersion())) { + return false; + } + if (!Objects.equals(_virtualComputeDesc, other.getVirtualComputeDesc())) { + return false; + } + if (!Objects.equals(_virtualStorageDesc, other.getVirtualStorageDesc())) { + return false; + } + if (!Objects.equals(_vnfmInfo, other.getVnfmInfo())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfdImpl otherImpl = (VnfdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vnfd"); + CodeHelpers.appendValue(helper, "_autoScale", _autoScale); + CodeHelpers.appendValue(helper, "_configurableProperties", _configurableProperties); + CodeHelpers.appendValue(helper, "_defaultLocalizationLanguage", _defaultLocalizationLanguage); + CodeHelpers.appendValue(helper, "_df", _df); + CodeHelpers.appendValue(helper, "_elementGroup", _elementGroup); + CodeHelpers.appendValue(helper, "_extCpd", _extCpd); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_indicator", _indicator); + CodeHelpers.appendValue(helper, "_intVirtualLinkDesc", _intVirtualLinkDesc); + CodeHelpers.appendValue(helper, "_lifecycleManagementScript", _lifecycleManagementScript); + CodeHelpers.appendValue(helper, "_localizationLanguage", _localizationLanguage); + CodeHelpers.appendValue(helper, "_modifiableAttributes", _modifiableAttributes); + CodeHelpers.appendValue(helper, "_productInfoDescription", _productInfoDescription); + CodeHelpers.appendValue(helper, "_productInfoName", _productInfoName); + CodeHelpers.appendValue(helper, "_productName", _productName); + CodeHelpers.appendValue(helper, "_provider", _provider); + CodeHelpers.appendValue(helper, "_securityGroupRule", _securityGroupRule); + CodeHelpers.appendValue(helper, "_softwareVersion", _softwareVersion); + CodeHelpers.appendValue(helper, "_swImageDesc", _swImageDesc); + CodeHelpers.appendValue(helper, "_vdu", _vdu); + CodeHelpers.appendValue(helper, "_version", _version); + CodeHelpers.appendValue(helper, "_virtualComputeDesc", _virtualComputeDesc); + CodeHelpers.appendValue(helper, "_virtualStorageDesc", _virtualStorageDesc); + CodeHelpers.appendValue(helper, "_vnfmInfo", _vnfmInfo); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/VnfdKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/VnfdKey.java new file mode 100644 index 0000000000000000000000000000000000000000..8eb3321481b1354ca49395a1c176ff65a03a6c21 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/nsd/rev190425/nsd/VnfdKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.nsd; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class VnfdKey + implements Identifier { + private static final long serialVersionUID = -7003982558180291733L; + private final String _id; + + + public VnfdKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VnfdKey(VnfdKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VnfdKey)) { + return false; + } + final VnfdKey other = (VnfdKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VnfdKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..83ae26819e6d8b6449a91c27a7a20280f118623b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.pnfd.rev190425; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..a35aa7e82e1d7b54d6a5717b36622b01b10ff4ad --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/$YangModuleInfoImpl.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.pnfd.rev190425; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:nfv:yang:etsi-nfv-pnfd", "2019-04-25", "etsi-nfv-pnfd").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/etsi-nfv-pnfd@2019-04-25.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/EtsiNfvPnfdData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/EtsiNfvPnfdData.java new file mode 100644 index 0000000000000000000000000000000000000000..49ceb408d62025f9ad56aec2067a67bed308b5fb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/EtsiNfvPnfdData.java @@ -0,0 +1,42 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.pnfd.rev190425; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataRoot; + +/** + * Physcial Network Function Descriptor. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-pnfd + *

+ * module etsi-nfv-pnfd {
+ *   yang-version 1.1;
+ *   namespace urn:etsi:nfv:yang:etsi-nfv-pnfd;
+ *   prefix pnfd;
+ *   import etsi-nfv-descriptors {
+ *     prefix vnf;
+ *   }
+ *   revision 2019-04-25 {
+ *   }
+ *   container pnfd {
+ *     presence "PNFD container.";
+ *     uses vnf:pnfd;
+ *   }
+ * }
+ * 
+ * + */ +public interface EtsiNfvPnfdData + extends + DataRoot +{ + + + + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.pnfd.rev190425.Pnfd pnfd, or null if not present + */ + @Nullable Pnfd getPnfd(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/Pnfd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/Pnfd.java new file mode 100644 index 0000000000000000000000000000000000000000..4a3cd48c5d953efb0ffc06088f9d71a54739b759 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/Pnfd.java @@ -0,0 +1,42 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.pnfd.rev190425; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-pnfd + *

+ * container pnfd {
+ *   presence "PNFD container.";
+ *   uses vnf:pnfd;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-pnfd/pnfd + * + *

To create instances of this class use {@link PnfdBuilder}. + * @see PnfdBuilder + * + */ +public interface Pnfd + extends + ChildOf, + Augmentable, + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("pnfd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.pnfd.rev190425.Pnfd.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/PnfdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/PnfdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..b740621d87a58cba0d0f08f11e8a21c71e3491d3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/pnfd/rev190425/PnfdBuilder.java @@ -0,0 +1,537 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.pnfd.rev190425; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.ExtCpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.ExtCpdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.Security; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.pnfd.SecurityKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRuleKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PnfdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PnfdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PnfdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PnfdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PnfdBuilder + * @see Builder + * + */ +public class PnfdBuilder implements Builder { + + private Map _extCpd; + private String _functionDescription; + private String _geographicalLocationInfo; + private String _id; + private String _invariantId; + private String _name; + private String _provider; + private Map _security; + private Map _securityGroupRule; + private String _version; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PnfdBuilder() { + } + public PnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd arg) { + this._id = arg.getId(); + this._functionDescription = arg.getFunctionDescription(); + this._provider = arg.getProvider(); + this._version = arg.getVersion(); + this._invariantId = arg.getInvariantId(); + this._name = arg.getName(); + this._extCpd = arg.getExtCpd(); + this._security = arg.getSecurity(); + this._geographicalLocationInfo = arg.getGeographicalLocationInfo(); + this._securityGroupRule = arg.getSecurityGroupRule(); + } + public PnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule arg) { + this._securityGroupRule = arg.getSecurityGroupRule(); + } + + public PnfdBuilder(Pnfd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._extCpd = base.getExtCpd(); + this._functionDescription = base.getFunctionDescription(); + this._geographicalLocationInfo = base.getGeographicalLocationInfo(); + this._id = base.getId(); + this._invariantId = base.getInvariantId(); + this._name = base.getName(); + this._provider = base.getProvider(); + this._security = base.getSecurity(); + this._securityGroupRule = base.getSecurityGroupRule(); + this._version = base.getVersion(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule) { + this._securityGroupRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule)arg).getSecurityGroupRule(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd) { + this._id = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getId(); + this._functionDescription = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getFunctionDescription(); + this._provider = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getProvider(); + this._version = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getVersion(); + this._invariantId = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getInvariantId(); + this._name = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getName(); + this._extCpd = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getExtCpd(); + this._security = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getSecurity(); + this._geographicalLocationInfo = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd)arg).getGeographicalLocationInfo(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule, org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Pnfd]"); + } + + public Map getExtCpd() { + return _extCpd; + } + + public String getFunctionDescription() { + return _functionDescription; + } + + public String getGeographicalLocationInfo() { + return _geographicalLocationInfo; + } + + public String getId() { + return _id; + } + + public String getInvariantId() { + return _invariantId; + } + + public String getName() { + return _name; + } + + public String getProvider() { + return _provider; + } + + public Map getSecurity() { + return _security; + } + + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + public String getVersion() { + return _version; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public PnfdBuilder setExtCpd(final Map values) { + this._extCpd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setExtCpd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public PnfdBuilder setExtCpd(final List values) { + return setExtCpd(CodeHelpers.compatMap(values)); + } + + public PnfdBuilder setFunctionDescription(final String value) { + this._functionDescription = value; + return this; + } + + public PnfdBuilder setGeographicalLocationInfo(final String value) { + this._geographicalLocationInfo = value; + return this; + } + + public PnfdBuilder setId(final String value) { + this._id = value; + return this; + } + + public PnfdBuilder setInvariantId(final String value) { + this._invariantId = value; + return this; + } + + public PnfdBuilder setName(final String value) { + this._name = value; + return this; + } + + public PnfdBuilder setProvider(final String value) { + this._provider = value; + return this; + } + public PnfdBuilder setSecurity(final Map values) { + this._security = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSecurity(Map)} instead. + */ + @Deprecated(forRemoval = true) + public PnfdBuilder setSecurity(final List values) { + return setSecurity(CodeHelpers.compatMap(values)); + } + public PnfdBuilder setSecurityGroupRule(final Map values) { + this._securityGroupRule = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSecurityGroupRule(Map)} instead. + */ + @Deprecated(forRemoval = true) + public PnfdBuilder setSecurityGroupRule(final List values) { + return setSecurityGroupRule(CodeHelpers.compatMap(values)); + } + + public PnfdBuilder setVersion(final String value) { + this._version = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PnfdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PnfdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PnfdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PnfdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Pnfd build() { + return new PnfdImpl(this); + } + + private static final class PnfdImpl + extends AbstractAugmentable + implements Pnfd { + + private final Map _extCpd; + private final String _functionDescription; + private final String _geographicalLocationInfo; + private final String _id; + private final String _invariantId; + private final String _name; + private final String _provider; + private final Map _security; + private final Map _securityGroupRule; + private final String _version; + + PnfdImpl(PnfdBuilder base) { + super(base.augmentation); + this._extCpd = CodeHelpers.emptyToNull(base.getExtCpd()); + this._functionDescription = base.getFunctionDescription(); + this._geographicalLocationInfo = base.getGeographicalLocationInfo(); + this._id = base.getId(); + this._invariantId = base.getInvariantId(); + this._name = base.getName(); + this._provider = base.getProvider(); + this._security = CodeHelpers.emptyToNull(base.getSecurity()); + this._securityGroupRule = CodeHelpers.emptyToNull(base.getSecurityGroupRule()); + this._version = base.getVersion(); + } + + @Override + public Map getExtCpd() { + return _extCpd; + } + + @Override + public String getFunctionDescription() { + return _functionDescription; + } + + @Override + public String getGeographicalLocationInfo() { + return _geographicalLocationInfo; + } + + @Override + public String getId() { + return _id; + } + + @Override + public String getInvariantId() { + return _invariantId; + } + + @Override + public String getName() { + return _name; + } + + @Override + public String getProvider() { + return _provider; + } + + @Override + public Map getSecurity() { + return _security; + } + + @Override + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + @Override + public String getVersion() { + return _version; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_extCpd); + result = prime * result + Objects.hashCode(_functionDescription); + result = prime * result + Objects.hashCode(_geographicalLocationInfo); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_invariantId); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_provider); + result = prime * result + Objects.hashCode(_security); + result = prime * result + Objects.hashCode(_securityGroupRule); + result = prime * result + Objects.hashCode(_version); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Pnfd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Pnfd other = (Pnfd)obj; + if (!Objects.equals(_extCpd, other.getExtCpd())) { + return false; + } + if (!Objects.equals(_functionDescription, other.getFunctionDescription())) { + return false; + } + if (!Objects.equals(_geographicalLocationInfo, other.getGeographicalLocationInfo())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_invariantId, other.getInvariantId())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_provider, other.getProvider())) { + return false; + } + if (!Objects.equals(_security, other.getSecurity())) { + return false; + } + if (!Objects.equals(_securityGroupRule, other.getSecurityGroupRule())) { + return false; + } + if (!Objects.equals(_version, other.getVersion())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PnfdImpl otherImpl = (PnfdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Pnfd"); + CodeHelpers.appendValue(helper, "_extCpd", _extCpd); + CodeHelpers.appendValue(helper, "_functionDescription", _functionDescription); + CodeHelpers.appendValue(helper, "_geographicalLocationInfo", _geographicalLocationInfo); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_invariantId", _invariantId); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_provider", _provider); + CodeHelpers.appendValue(helper, "_security", _security); + CodeHelpers.appendValue(helper, "_securityGroupRule", _securityGroupRule); + CodeHelpers.appendValue(helper, "_version", _version); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..87070fd67816f7ae1d078aa6b3742da1e91de141 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ce967fdcee1043a198672d6c85bd06a1cf7a076f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/$YangModuleInfoImpl.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:nfv:yang:etsi-nfv-vnfd", "2019-03-18", "etsi-nfv-vnfd").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/etsi-nfv-vnfd@2019-03-18.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/EtsiNfvVnfdData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/EtsiNfvVnfdData.java new file mode 100644 index 0000000000000000000000000000000000000000..b4d6fc51963acee8e13b177f353718dc4e402cb9 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/EtsiNfvVnfdData.java @@ -0,0 +1,42 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataRoot; + +/** + * Virtual Network Function Descriptor. + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-vnfd + *

+ * module etsi-nfv-vnfd {
+ *   yang-version 1.1;
+ *   namespace urn:etsi:nfv:yang:etsi-nfv-vnfd;
+ *   prefix vnfd;
+ *   import etsi-nfv-descriptors {
+ *     prefix vnf;
+ *   }
+ *   revision 2019-03-18 {
+ *   }
+ *   container vnfd {
+ *     presence "VNFD container.";
+ *     uses vnf:vnfd;
+ *   }
+ * }
+ * 
+ * + */ +public interface EtsiNfvVnfdData + extends + DataRoot +{ + + + + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.Vnfd vnfd, or null if not present + */ + @Nullable Vnfd getVnfd(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/Vnfd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/Vnfd.java new file mode 100644 index 0000000000000000000000000000000000000000..d69acc87e9c3191b9ebe4eac99ad64f14f03a0d9 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/Vnfd.java @@ -0,0 +1,42 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module etsi-nfv-vnfd + *

+ * container vnfd {
+ *   presence "VNFD container.";
+ *   uses vnf:vnfd;
+ * }
+ * 
The schema path to identify an instance is + * etsi-nfv-vnfd/vnfd + * + *

To create instances of this class use {@link VnfdBuilder}. + * @see VnfdBuilder + * + */ +public interface Vnfd + extends + ChildOf, + Augmentable, + org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnfd"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.Vnfd.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/VnfdBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/VnfdBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..f727dff29ce7de3337b47720c494ec631e0fc4fe --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/nfv/yang/etsi/nfv/vnfd/rev190318/VnfdBuilder.java @@ -0,0 +1,1044 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRule; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.security.group.rule.SecurityGroupRuleKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ConfigurableProperties; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Df; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.DfKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ElementGroup; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ElementGroupKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ExtCpd; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ExtCpdKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Indicator; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IndicatorKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IntVirtualLinkDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.IntVirtualLinkDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.LifecycleManagementScript; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.LifecycleManagementScriptKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.ModifiableAttributes; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VduKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualComputeDescKey; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDescKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VnfdBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VnfdBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VnfdBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VnfdBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VnfdBuilder + * @see Builder + * + */ +public class VnfdBuilder implements Builder { + + private List _autoScale; + private ConfigurableProperties _configurableProperties; + private String _defaultLocalizationLanguage; + private Map _df; + private Map _elementGroup; + private Map _extCpd; + private String _id; + private Map _indicator; + private Map _intVirtualLinkDesc; + private Map _lifecycleManagementScript; + private String _localizationLanguage; + private ModifiableAttributes _modifiableAttributes; + private String _productInfoDescription; + private String _productInfoName; + private String _productName; + private String _provider; + private Map _securityGroupRule; + private String _softwareVersion; + private Map _swImageDesc; + private Map _vdu; + private String _version; + private Map _virtualComputeDesc; + private Map _virtualStorageDesc; + private List _vnfmInfo; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VnfdBuilder() { + } + public VnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd arg) { + this._id = arg.getId(); + this._provider = arg.getProvider(); + this._productName = arg.getProductName(); + this._softwareVersion = arg.getSoftwareVersion(); + this._version = arg.getVersion(); + this._productInfoName = arg.getProductInfoName(); + this._productInfoDescription = arg.getProductInfoDescription(); + this._vnfmInfo = arg.getVnfmInfo(); + this._localizationLanguage = arg.getLocalizationLanguage(); + this._defaultLocalizationLanguage = arg.getDefaultLocalizationLanguage(); + this._vdu = arg.getVdu(); + this._virtualComputeDesc = arg.getVirtualComputeDesc(); + this._virtualStorageDesc = arg.getVirtualStorageDesc(); + this._swImageDesc = arg.getSwImageDesc(); + this._intVirtualLinkDesc = arg.getIntVirtualLinkDesc(); + this._extCpd = arg.getExtCpd(); + this._df = arg.getDf(); + this._configurableProperties = arg.getConfigurableProperties(); + this._modifiableAttributes = arg.getModifiableAttributes(); + this._lifecycleManagementScript = arg.getLifecycleManagementScript(); + this._elementGroup = arg.getElementGroup(); + this._indicator = arg.getIndicator(); + this._autoScale = arg.getAutoScale(); + this._securityGroupRule = arg.getSecurityGroupRule(); + } + public VnfdBuilder(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule arg) { + this._securityGroupRule = arg.getSecurityGroupRule(); + } + + public VnfdBuilder(Vnfd base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._autoScale = base.getAutoScale(); + this._configurableProperties = base.getConfigurableProperties(); + this._defaultLocalizationLanguage = base.getDefaultLocalizationLanguage(); + this._df = base.getDf(); + this._elementGroup = base.getElementGroup(); + this._extCpd = base.getExtCpd(); + this._id = base.getId(); + this._indicator = base.getIndicator(); + this._intVirtualLinkDesc = base.getIntVirtualLinkDesc(); + this._lifecycleManagementScript = base.getLifecycleManagementScript(); + this._localizationLanguage = base.getLocalizationLanguage(); + this._modifiableAttributes = base.getModifiableAttributes(); + this._productInfoDescription = base.getProductInfoDescription(); + this._productInfoName = base.getProductInfoName(); + this._productName = base.getProductName(); + this._provider = base.getProvider(); + this._securityGroupRule = base.getSecurityGroupRule(); + this._softwareVersion = base.getSoftwareVersion(); + this._swImageDesc = base.getSwImageDesc(); + this._vdu = base.getVdu(); + this._version = base.getVersion(); + this._virtualComputeDesc = base.getVirtualComputeDesc(); + this._virtualStorageDesc = base.getVirtualStorageDesc(); + this._vnfmInfo = base.getVnfmInfo(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule) { + this._securityGroupRule = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule)arg).getSecurityGroupRule(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd) { + this._id = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getId(); + this._provider = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProvider(); + this._productName = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProductName(); + this._softwareVersion = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getSoftwareVersion(); + this._version = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVersion(); + this._productInfoName = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProductInfoName(); + this._productInfoDescription = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getProductInfoDescription(); + this._vnfmInfo = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVnfmInfo(); + this._localizationLanguage = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getLocalizationLanguage(); + this._defaultLocalizationLanguage = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getDefaultLocalizationLanguage(); + this._vdu = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVdu(); + this._virtualComputeDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVirtualComputeDesc(); + this._virtualStorageDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getVirtualStorageDesc(); + this._swImageDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getSwImageDesc(); + this._intVirtualLinkDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getIntVirtualLinkDesc(); + this._extCpd = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getExtCpd(); + this._df = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getDf(); + this._configurableProperties = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getConfigurableProperties(); + this._modifiableAttributes = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getModifiableAttributes(); + this._lifecycleManagementScript = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getLifecycleManagementScript(); + this._elementGroup = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getElementGroup(); + this._indicator = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getIndicator(); + this._autoScale = ((org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd)arg).getAutoScale(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.SecurityGroupRule, org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.Vnfd]"); + } + + public List getAutoScale() { + return _autoScale; + } + + public ConfigurableProperties getConfigurableProperties() { + return _configurableProperties; + } + + public String getDefaultLocalizationLanguage() { + return _defaultLocalizationLanguage; + } + + public Map getDf() { + return _df; + } + + public Map getElementGroup() { + return _elementGroup; + } + + public Map getExtCpd() { + return _extCpd; + } + + public String getId() { + return _id; + } + + public Map getIndicator() { + return _indicator; + } + + public Map getIntVirtualLinkDesc() { + return _intVirtualLinkDesc; + } + + public Map getLifecycleManagementScript() { + return _lifecycleManagementScript; + } + + public String getLocalizationLanguage() { + return _localizationLanguage; + } + + public ModifiableAttributes getModifiableAttributes() { + return _modifiableAttributes; + } + + public String getProductInfoDescription() { + return _productInfoDescription; + } + + public String getProductInfoName() { + return _productInfoName; + } + + public String getProductName() { + return _productName; + } + + public String getProvider() { + return _provider; + } + + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + public String getSoftwareVersion() { + return _softwareVersion; + } + + public Map getSwImageDesc() { + return _swImageDesc; + } + + public Map getVdu() { + return _vdu; + } + + public String getVersion() { + return _version; + } + + public Map getVirtualComputeDesc() { + return _virtualComputeDesc; + } + + public Map getVirtualStorageDesc() { + return _virtualStorageDesc; + } + + public List getVnfmInfo() { + return _vnfmInfo; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VnfdBuilder setAutoScale(final List values) { + this._autoScale = values; + return this; + } + + + public VnfdBuilder setConfigurableProperties(final ConfigurableProperties value) { + this._configurableProperties = value; + return this; + } + + public VnfdBuilder setDefaultLocalizationLanguage(final String value) { + this._defaultLocalizationLanguage = value; + return this; + } + public VnfdBuilder setDf(final Map values) { + this._df = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setDf(Map)} instead. + */ + @Deprecated(forRemoval = true) + @JsonIgnore + public VnfdBuilder setDf(final List values) { + return setDf(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setElementGroup(final Map values) { + this._elementGroup = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setElementGroup(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setElementGroup(final List values) { + return setElementGroup(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setExtCpd(final Map values) { + this._extCpd = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setExtCpd(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setExtCpd(final List values) { + return setExtCpd(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setId(final String value) { + this._id = value; + return this; + } + public VnfdBuilder setIndicator(final Map values) { + this._indicator = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setIndicator(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setIndicator(final List values) { + return setIndicator(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setIntVirtualLinkDesc(final Map values) { + this._intVirtualLinkDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setIntVirtualLinkDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setIntVirtualLinkDesc(final List values) { + return setIntVirtualLinkDesc(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setLifecycleManagementScript(final Map values) { + this._lifecycleManagementScript = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setLifecycleManagementScript(Map)} instead. + */ + @Deprecated(forRemoval = true) + @JsonIgnore + public VnfdBuilder setLifecycleManagementScript(final List values) { + return setLifecycleManagementScript(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setLocalizationLanguage(final String value) { + this._localizationLanguage = value; + return this; + } + + public VnfdBuilder setModifiableAttributes(final ModifiableAttributes value) { + this._modifiableAttributes = value; + return this; + } + + public VnfdBuilder setProductInfoDescription(final String value) { + this._productInfoDescription = value; + return this; + } + + public VnfdBuilder setProductInfoName(final String value) { + this._productInfoName = value; + return this; + } + + public VnfdBuilder setProductName(final String value) { + this._productName = value; + return this; + } + + public VnfdBuilder setProvider(final String value) { + this._provider = value; + return this; + } + public VnfdBuilder setSecurityGroupRule(final Map values) { + this._securityGroupRule = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSecurityGroupRule(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setSecurityGroupRule(final List values) { + return setSecurityGroupRule(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setSoftwareVersion(final String value) { + this._softwareVersion = value; + return this; + } + public VnfdBuilder setSwImageDesc(final Map values) { + this._swImageDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setSwImageDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setSwImageDesc(final List values) { + return setSwImageDesc(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setVdu(final Map values) { + this._vdu = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVdu(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setVdu(final List values) { + return setVdu(CodeHelpers.compatMap(values)); + } + + public VnfdBuilder setVersion(final String value) { + this._version = value; + return this; + } + public VnfdBuilder setVirtualComputeDesc(final Map values) { + this._virtualComputeDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualComputeDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setVirtualComputeDesc(final List values) { + return setVirtualComputeDesc(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setVirtualStorageDesc(final Map values) { + this._virtualStorageDesc = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVirtualStorageDesc(Map)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder setVirtualStorageDesc(final List values) { + return setVirtualStorageDesc(CodeHelpers.compatMap(values)); + } + public VnfdBuilder setVnfmInfo(final List values) { + this._vnfmInfo = values; + return this; + } + + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VnfdBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VnfdBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VnfdBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VnfdBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Vnfd build() { + return new VnfdImpl(this); + } + + private static final class VnfdImpl + extends AbstractAugmentable + implements Vnfd { + + private final List _autoScale; + private final ConfigurableProperties _configurableProperties; + private final String _defaultLocalizationLanguage; + private final Map _df; + private final Map _elementGroup; + private final Map _extCpd; + private final String _id; + private final Map _indicator; + private final Map _intVirtualLinkDesc; + private final Map _lifecycleManagementScript; + private final String _localizationLanguage; + private final ModifiableAttributes _modifiableAttributes; + private final String _productInfoDescription; + private final String _productInfoName; + private final String _productName; + private final String _provider; + private final Map _securityGroupRule; + private final String _softwareVersion; + private final Map _swImageDesc; + private final Map _vdu; + private final String _version; + private final Map _virtualComputeDesc; + private final Map _virtualStorageDesc; + private final List _vnfmInfo; + + VnfdImpl(VnfdBuilder base) { + super(base.augmentation); + this._autoScale = base.getAutoScale(); + this._configurableProperties = base.getConfigurableProperties(); + this._defaultLocalizationLanguage = base.getDefaultLocalizationLanguage(); + this._df = CodeHelpers.emptyToNull(base.getDf()); + this._elementGroup = CodeHelpers.emptyToNull(base.getElementGroup()); + this._extCpd = CodeHelpers.emptyToNull(base.getExtCpd()); + this._id = base.getId(); + this._indicator = CodeHelpers.emptyToNull(base.getIndicator()); + this._intVirtualLinkDesc = CodeHelpers.emptyToNull(base.getIntVirtualLinkDesc()); + this._lifecycleManagementScript = CodeHelpers.emptyToNull(base.getLifecycleManagementScript()); + this._localizationLanguage = base.getLocalizationLanguage(); + this._modifiableAttributes = base.getModifiableAttributes(); + this._productInfoDescription = base.getProductInfoDescription(); + this._productInfoName = base.getProductInfoName(); + this._productName = base.getProductName(); + this._provider = base.getProvider(); + this._securityGroupRule = CodeHelpers.emptyToNull(base.getSecurityGroupRule()); + this._softwareVersion = base.getSoftwareVersion(); + this._swImageDesc = CodeHelpers.emptyToNull(base.getSwImageDesc()); + this._vdu = CodeHelpers.emptyToNull(base.getVdu()); + this._version = base.getVersion(); + this._virtualComputeDesc = CodeHelpers.emptyToNull(base.getVirtualComputeDesc()); + this._virtualStorageDesc = CodeHelpers.emptyToNull(base.getVirtualStorageDesc()); + this._vnfmInfo = base.getVnfmInfo(); + } + + @Override + public List getAutoScale() { + return _autoScale; + } + + @Override + public ConfigurableProperties getConfigurableProperties() { + return _configurableProperties; + } + + @Override + public String getDefaultLocalizationLanguage() { + return _defaultLocalizationLanguage; + } + + @Override + public Map getDf() { + return _df; + } + + @Override + public Map getElementGroup() { + return _elementGroup; + } + + @Override + public Map getExtCpd() { + return _extCpd; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getIndicator() { + return _indicator; + } + + @Override + public Map getIntVirtualLinkDesc() { + return _intVirtualLinkDesc; + } + + @Override + public Map getLifecycleManagementScript() { + return _lifecycleManagementScript; + } + + @Override + public String getLocalizationLanguage() { + return _localizationLanguage; + } + + @Override + public ModifiableAttributes getModifiableAttributes() { + return _modifiableAttributes; + } + + @Override + public String getProductInfoDescription() { + return _productInfoDescription; + } + + @Override + public String getProductInfoName() { + return _productInfoName; + } + + @Override + public String getProductName() { + return _productName; + } + + @Override + public String getProvider() { + return _provider; + } + + @Override + public Map getSecurityGroupRule() { + return _securityGroupRule; + } + + @Override + public String getSoftwareVersion() { + return _softwareVersion; + } + + @Override + public Map getSwImageDesc() { + return _swImageDesc; + } + + @Override + public Map getVdu() { + return _vdu; + } + + @Override + public String getVersion() { + return _version; + } + + @Override + public Map getVirtualComputeDesc() { + return _virtualComputeDesc; + } + + @Override + public Map getVirtualStorageDesc() { + return _virtualStorageDesc; + } + + @Override + public List getVnfmInfo() { + return _vnfmInfo; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_autoScale); + result = prime * result + Objects.hashCode(_configurableProperties); + result = prime * result + Objects.hashCode(_defaultLocalizationLanguage); + result = prime * result + Objects.hashCode(_df); + result = prime * result + Objects.hashCode(_elementGroup); + result = prime * result + Objects.hashCode(_extCpd); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_indicator); + result = prime * result + Objects.hashCode(_intVirtualLinkDesc); + result = prime * result + Objects.hashCode(_lifecycleManagementScript); + result = prime * result + Objects.hashCode(_localizationLanguage); + result = prime * result + Objects.hashCode(_modifiableAttributes); + result = prime * result + Objects.hashCode(_productInfoDescription); + result = prime * result + Objects.hashCode(_productInfoName); + result = prime * result + Objects.hashCode(_productName); + result = prime * result + Objects.hashCode(_provider); + result = prime * result + Objects.hashCode(_securityGroupRule); + result = prime * result + Objects.hashCode(_softwareVersion); + result = prime * result + Objects.hashCode(_swImageDesc); + result = prime * result + Objects.hashCode(_vdu); + result = prime * result + Objects.hashCode(_version); + result = prime * result + Objects.hashCode(_virtualComputeDesc); + result = prime * result + Objects.hashCode(_virtualStorageDesc); + result = prime * result + Objects.hashCode(_vnfmInfo); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vnfd.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vnfd other = (Vnfd)obj; + if (!Objects.equals(_autoScale, other.getAutoScale())) { + return false; + } + if (!Objects.equals(_configurableProperties, other.getConfigurableProperties())) { + return false; + } + if (!Objects.equals(_defaultLocalizationLanguage, other.getDefaultLocalizationLanguage())) { + return false; + } + if (!Objects.equals(_df, other.getDf())) { + return false; + } + if (!Objects.equals(_elementGroup, other.getElementGroup())) { + return false; + } + if (!Objects.equals(_extCpd, other.getExtCpd())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_indicator, other.getIndicator())) { + return false; + } + if (!Objects.equals(_intVirtualLinkDesc, other.getIntVirtualLinkDesc())) { + return false; + } + if (!Objects.equals(_lifecycleManagementScript, other.getLifecycleManagementScript())) { + return false; + } + if (!Objects.equals(_localizationLanguage, other.getLocalizationLanguage())) { + return false; + } + if (!Objects.equals(_modifiableAttributes, other.getModifiableAttributes())) { + return false; + } + if (!Objects.equals(_productInfoDescription, other.getProductInfoDescription())) { + return false; + } + if (!Objects.equals(_productInfoName, other.getProductInfoName())) { + return false; + } + if (!Objects.equals(_productName, other.getProductName())) { + return false; + } + if (!Objects.equals(_provider, other.getProvider())) { + return false; + } + if (!Objects.equals(_securityGroupRule, other.getSecurityGroupRule())) { + return false; + } + if (!Objects.equals(_softwareVersion, other.getSoftwareVersion())) { + return false; + } + if (!Objects.equals(_swImageDesc, other.getSwImageDesc())) { + return false; + } + if (!Objects.equals(_vdu, other.getVdu())) { + return false; + } + if (!Objects.equals(_version, other.getVersion())) { + return false; + } + if (!Objects.equals(_virtualComputeDesc, other.getVirtualComputeDesc())) { + return false; + } + if (!Objects.equals(_virtualStorageDesc, other.getVirtualStorageDesc())) { + return false; + } + if (!Objects.equals(_vnfmInfo, other.getVnfmInfo())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VnfdImpl otherImpl = (VnfdImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vnfd"); + CodeHelpers.appendValue(helper, "_autoScale", _autoScale); + CodeHelpers.appendValue(helper, "_configurableProperties", _configurableProperties); + CodeHelpers.appendValue(helper, "_defaultLocalizationLanguage", _defaultLocalizationLanguage); + CodeHelpers.appendValue(helper, "_df", _df); + CodeHelpers.appendValue(helper, "_elementGroup", _elementGroup); + CodeHelpers.appendValue(helper, "_extCpd", _extCpd); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_indicator", _indicator); + CodeHelpers.appendValue(helper, "_intVirtualLinkDesc", _intVirtualLinkDesc); + CodeHelpers.appendValue(helper, "_lifecycleManagementScript", _lifecycleManagementScript); + CodeHelpers.appendValue(helper, "_localizationLanguage", _localizationLanguage); + CodeHelpers.appendValue(helper, "_modifiableAttributes", _modifiableAttributes); + CodeHelpers.appendValue(helper, "_productInfoDescription", _productInfoDescription); + CodeHelpers.appendValue(helper, "_productInfoName", _productInfoName); + CodeHelpers.appendValue(helper, "_productName", _productName); + CodeHelpers.appendValue(helper, "_provider", _provider); + CodeHelpers.appendValue(helper, "_securityGroupRule", _securityGroupRule); + CodeHelpers.appendValue(helper, "_softwareVersion", _softwareVersion); + CodeHelpers.appendValue(helper, "_swImageDesc", _swImageDesc); + CodeHelpers.appendValue(helper, "_vdu", _vdu); + CodeHelpers.appendValue(helper, "_version", _version); + CodeHelpers.appendValue(helper, "_virtualComputeDesc", _virtualComputeDesc); + CodeHelpers.appendValue(helper, "_virtualStorageDesc", _virtualStorageDesc); + CodeHelpers.appendValue(helper, "_vnfmInfo", _vnfmInfo); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..92fc52f4be6530eccce4bb2d3a93ea9b7fcce34f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ba4c9778b20d0ff65ed5196d4a8b83b29a7e191d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/$YangModuleInfoImpl.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:osm:yang:alternative-images", "alternative-images").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/alternative-images.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/ExtendedAlternativeImages.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/ExtendedAlternativeImages.java new file mode 100644 index 0000000000000000000000000000000000000000..f9cc91bf83e06c2e0e0f15afeb091a146529914b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/ExtendedAlternativeImages.java @@ -0,0 +1,53 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module alternative-images + *

+ * grouping extended-alternative-images {
+ *   leaf-list alternative-sw-image-desc {
+ *     type leafref {
+ *       path /vnfd:vnfd/vnfd:sw-image-desc/vnfd:id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * alternative-images/extended-alternative-images + * + */ +public interface ExtendedAlternativeImages + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-alternative-images"); + + @Override + Class implementedInterface(); + + /** + * List of alternative images per VIM type. Different images can be used for + * specific types of VIMs instead of the default image. This allows deployments in + * sites where the image identifier in the VIM is given by the VIM provider and + * cannot be modified. If an alternative image is specified for a VIM type, it will + * prevail over the default image + * + * + * + * @return java.util.List alternativeSwImageDesc, or null if not present + */ + @Nullable List getAlternativeSwImageDesc(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/ExtendedVimType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/ExtendedVimType.java new file mode 100644 index 0000000000000000000000000000000000000000..b066171c0182ff205c81fa1b24705e0d334915b7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/ExtendedVimType.java @@ -0,0 +1,46 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module alternative-images + *

+ * grouping extended-vim-type {
+ *   leaf vim-type {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * alternative-images/extended-vim-type + * + */ +public interface ExtendedVimType + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-vim-type"); + + @Override + Class implementedInterface(); + + /** + * VIM type: openvim, openstack, vmware, aws, etc. + * + * + * + * @return java.lang.String vimType, or null if not present + */ + @Nullable String getVimType(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/SwImageDesc1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/SwImageDesc1.java new file mode 100644 index 0000000000000000000000000000000000000000..ddd36f4e96843414c98e0dc736a215d341dbab02 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/SwImageDesc1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.SwImageDesc; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface SwImageDesc1 + extends + Augmentation, + ExtendedVimType +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.SwImageDesc1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/SwImageDesc1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/SwImageDesc1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..40c60dcceedfd8fa90f90749a9c2445930739652 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/SwImageDesc1Builder.java @@ -0,0 +1,157 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link SwImageDesc1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     SwImageDesc1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new SwImageDesc1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of SwImageDesc1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see SwImageDesc1Builder + * @see Builder + * + */ +public class SwImageDesc1Builder implements Builder { + + private String _vimType; + + + + public SwImageDesc1Builder() { + } + public SwImageDesc1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.ExtendedVimType arg) { + this._vimType = arg.getVimType(); + } + + public SwImageDesc1Builder(SwImageDesc1 base) { + this._vimType = base.getVimType(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.ExtendedVimType
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.ExtendedVimType) { + this._vimType = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.ExtendedVimType)arg).getVimType(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.ExtendedVimType]"); + } + + public String getVimType() { + return _vimType; + } + + + public SwImageDesc1Builder setVimType(final String value) { + this._vimType = value; + return this; + } + + + @Override + public SwImageDesc1 build() { + return new SwImageDesc1Impl(this); + } + + private static final class SwImageDesc1Impl + implements SwImageDesc1 { + + private final String _vimType; + + SwImageDesc1Impl(SwImageDesc1Builder base) { + this._vimType = base.getVimType(); + } + + @Override + public String getVimType() { + return _vimType; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_vimType); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!SwImageDesc1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + SwImageDesc1 other = (SwImageDesc1)obj; + if (!Objects.equals(_vimType, other.getVimType())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("SwImageDesc1"); + CodeHelpers.appendValue(helper, "_vimType", _vimType); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/Vdu1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/Vdu1.java new file mode 100644 index 0000000000000000000000000000000000000000..3cb39b7523f3c1623c38789cc4923ea098443b51 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/Vdu1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface Vdu1 + extends + Augmentation, + ExtendedAlternativeImages +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.Vdu1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/Vdu1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/Vdu1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..766f16aefef5c3f9c8442c51490ddd49f2f31cac --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/alternative/images/norev/Vdu1Builder.java @@ -0,0 +1,158 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link Vdu1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     Vdu1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new Vdu1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of Vdu1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see Vdu1Builder + * @see Builder + * + */ +public class Vdu1Builder implements Builder { + + private List _alternativeSwImageDesc; + + + + public Vdu1Builder() { + } + public Vdu1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.ExtendedAlternativeImages arg) { + this._alternativeSwImageDesc = arg.getAlternativeSwImageDesc(); + } + + public Vdu1Builder(Vdu1 base) { + this._alternativeSwImageDesc = base.getAlternativeSwImageDesc(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.ExtendedAlternativeImages
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.ExtendedAlternativeImages) { + this._alternativeSwImageDesc = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.ExtendedAlternativeImages)arg).getAlternativeSwImageDesc(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.alternative.images.norev.ExtendedAlternativeImages]"); + } + + public List getAlternativeSwImageDesc() { + return _alternativeSwImageDesc; + } + + public Vdu1Builder setAlternativeSwImageDesc(final List values) { + this._alternativeSwImageDesc = values; + return this; + } + + + + @Override + public Vdu1 build() { + return new Vdu1Impl(this); + } + + private static final class Vdu1Impl + implements Vdu1 { + + private final List _alternativeSwImageDesc; + + Vdu1Impl(Vdu1Builder base) { + this._alternativeSwImageDesc = base.getAlternativeSwImageDesc(); + } + + @Override + public List getAlternativeSwImageDesc() { + return _alternativeSwImageDesc; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_alternativeSwImageDesc); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vdu1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vdu1 other = (Vdu1)obj; + if (!Objects.equals(_alternativeSwImageDesc, other.getAlternativeSwImageDesc())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vdu1"); + CodeHelpers.appendValue(helper, "_alternativeSwImageDesc", _alternativeSwImageDesc); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..539e7f428308b356eb425996e6373bf04dc93654 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7eb83a0ed576dbeb9c4566c5be8f1555bc1c759b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/$YangModuleInfoImpl.java @@ -0,0 +1,49 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:osm:yang:augments:interface", "interface").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.$YangModuleInfoImpl.getInstance()); + set.add(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.$YangModuleInfoImpl.getInstance()); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/interface.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/ExtendedInterface.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/ExtendedInterface.java new file mode 100644 index 0000000000000000000000000000000000000000..8f260cf4bf1e3cf29d35c9116271a2a753359f42 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/ExtendedInterface.java @@ -0,0 +1,79 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VirtualInterface; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * List of Interfaces (external and internal) for the VNF + * + *

+ * This class represents the following YANG schema fragment defined in module interface + *

+ * grouping extended-interface {
+ *   leaf position {
+ *     type uint32;
+ *   }
+ *   leaf ip-address {
+ *     type inet:ip-address;
+ *   }
+ *   leaf mac-address {
+ *     type string;
+ *   }
+ *   uses common:virtual-interface;
+ * }
+ * 
The schema path to identify an instance is + * interface/extended-interface + * + */ +public interface ExtendedInterface + extends + DataObject, + VirtualInterface +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-interface"); + + @Override + Class implementedInterface(); + + /** + * Explicit Position of the interface within the list + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 position, or null if not present + */ + @Nullable Uint32 getPosition(); + + /** + * IP address of the internal connection point + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress ipAddress, or null if not present + */ + @Nullable IpAddress getIpAddress(); + + /** + * MAC address of the interface. Some VNFs require a specific MAC address to be + * configured in the interface. While this is not recommended at all in NFV + * environments, this parameter exists to allow those scenarios. This parameter + * will be likely deprecated in the future. + * + * + * + * @return java.lang.String macAddress, or null if not present + */ + @Nullable String getMacAddress(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/VirtualNetworkInterfaceRequirement1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/VirtualNetworkInterfaceRequirement1.java new file mode 100644 index 0000000000000000000000000000000000000000..2475b67c5a0586b17a87aa4cc72f92469a30a273 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/VirtualNetworkInterfaceRequirement1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.VirtualNetworkInterfaceRequirement; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface VirtualNetworkInterfaceRequirement1 + extends + Augmentation, + ExtendedInterface +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev.VirtualNetworkInterfaceRequirement1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/VirtualNetworkInterfaceRequirement1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/VirtualNetworkInterfaceRequirement1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..0fe93678db9b6d7390ec650b131107aacc0a63e4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/_interface/norev/VirtualNetworkInterfaceRequirement1Builder.java @@ -0,0 +1,255 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev; +import com.google.common.base.MoreObjects; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.virtual._interface.VirtualInterface; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link VirtualNetworkInterfaceRequirement1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualNetworkInterfaceRequirement1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualNetworkInterfaceRequirement1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualNetworkInterfaceRequirement1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualNetworkInterfaceRequirement1Builder + * @see Builder + * + */ +public class VirtualNetworkInterfaceRequirement1Builder implements Builder { + + private IpAddress _ipAddress; + private String _macAddress; + private Uint32 _position; + private VirtualInterface _virtualInterface; + + + + public VirtualNetworkInterfaceRequirement1Builder() { + } + public VirtualNetworkInterfaceRequirement1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev.ExtendedInterface arg) { + this._position = arg.getPosition(); + this._ipAddress = arg.getIpAddress(); + this._macAddress = arg.getMacAddress(); + this._virtualInterface = arg.getVirtualInterface(); + } + public VirtualNetworkInterfaceRequirement1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VirtualInterface arg) { + this._virtualInterface = arg.getVirtualInterface(); + } + + public VirtualNetworkInterfaceRequirement1Builder(VirtualNetworkInterfaceRequirement1 base) { + this._ipAddress = base.getIpAddress(); + this._macAddress = base.getMacAddress(); + this._position = base.getPosition(); + this._virtualInterface = base.getVirtualInterface(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VirtualInterface
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev.ExtendedInterface
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VirtualInterface) { + this._virtualInterface = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VirtualInterface)arg).getVirtualInterface(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev.ExtendedInterface) { + this._position = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev.ExtendedInterface)arg).getPosition(); + this._ipAddress = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev.ExtendedInterface)arg).getIpAddress(); + this._macAddress = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev.ExtendedInterface)arg).getMacAddress(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VirtualInterface, org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments._interface.norev.ExtendedInterface]"); + } + + public IpAddress getIpAddress() { + return _ipAddress; + } + + public String getMacAddress() { + return _macAddress; + } + + public Uint32 getPosition() { + return _position; + } + + public VirtualInterface getVirtualInterface() { + return _virtualInterface; + } + + + public VirtualNetworkInterfaceRequirement1Builder setIpAddress(final IpAddress value) { + this._ipAddress = value; + return this; + } + + public VirtualNetworkInterfaceRequirement1Builder setMacAddress(final String value) { + this._macAddress = value; + return this; + } + + public VirtualNetworkInterfaceRequirement1Builder setPosition(final Uint32 value) { + this._position = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setPosition(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualNetworkInterfaceRequirement1Builder setPosition(final Long value) { + return setPosition(CodeHelpers.compatUint(value)); + } + + public VirtualNetworkInterfaceRequirement1Builder setVirtualInterface(final VirtualInterface value) { + this._virtualInterface = value; + return this; + } + + + @Override + public VirtualNetworkInterfaceRequirement1 build() { + return new VirtualNetworkInterfaceRequirement1Impl(this); + } + + private static final class VirtualNetworkInterfaceRequirement1Impl + implements VirtualNetworkInterfaceRequirement1 { + + private final IpAddress _ipAddress; + private final String _macAddress; + private final Uint32 _position; + private final VirtualInterface _virtualInterface; + + VirtualNetworkInterfaceRequirement1Impl(VirtualNetworkInterfaceRequirement1Builder base) { + this._ipAddress = base.getIpAddress(); + this._macAddress = base.getMacAddress(); + this._position = base.getPosition(); + this._virtualInterface = base.getVirtualInterface(); + } + + @Override + public IpAddress getIpAddress() { + return _ipAddress; + } + + @Override + public String getMacAddress() { + return _macAddress; + } + + @Override + public Uint32 getPosition() { + return _position; + } + + @Override + public VirtualInterface getVirtualInterface() { + return _virtualInterface; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_ipAddress); + result = prime * result + Objects.hashCode(_macAddress); + result = prime * result + Objects.hashCode(_position); + result = prime * result + Objects.hashCode(_virtualInterface); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualNetworkInterfaceRequirement1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualNetworkInterfaceRequirement1 other = (VirtualNetworkInterfaceRequirement1)obj; + if (!Objects.equals(_ipAddress, other.getIpAddress())) { + return false; + } + if (!Objects.equals(_macAddress, other.getMacAddress())) { + return false; + } + if (!Objects.equals(_position, other.getPosition())) { + return false; + } + if (!Objects.equals(_virtualInterface, other.getVirtualInterface())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualNetworkInterfaceRequirement1"); + CodeHelpers.appendValue(helper, "_ipAddress", _ipAddress); + CodeHelpers.appendValue(helper, "_macAddress", _macAddress); + CodeHelpers.appendValue(helper, "_position", _position); + CodeHelpers.appendValue(helper, "_virtualInterface", _virtualInterface); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..05c655215e0acf71bfad989930812d48167942b7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.additional.info.norev; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0195d62741855c36b4b87c091be383457670e952 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/$YangModuleInfoImpl.java @@ -0,0 +1,48 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.additional.info.norev; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:osm:yang:augments:additional-info", "additional-info").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.$YangModuleInfoImpl.getInstance()); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/additional-info.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/L3ProtocolData1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/L3ProtocolData1.java new file mode 100644 index 0000000000000000000000000000000000000000..01f39080f54d241a3fccb72281fd46a4a4ae48ba --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/L3ProtocolData1.java @@ -0,0 +1,23 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.additional.info.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.virtual.link.profile.virtual.link.protocol.data.L3ProtocolData; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface L3ProtocolData1 + extends + Augmentation, + Description +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.additional.info.norev.L3ProtocolData1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/L3ProtocolData1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/L3ProtocolData1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..11d32ad5e9eeaca5f66a7146befd91ea0c67188a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/L3ProtocolData1Builder.java @@ -0,0 +1,157 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.additional.info.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link L3ProtocolData1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     L3ProtocolData1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new L3ProtocolData1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of L3ProtocolData1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see L3ProtocolData1Builder + * @see Builder + * + */ +public class L3ProtocolData1Builder implements Builder { + + private String _description; + + + + public L3ProtocolData1Builder() { + } + public L3ProtocolData1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description arg) { + this._description = arg.getDescription(); + } + + public L3ProtocolData1Builder(L3ProtocolData1 base) { + this._description = base.getDescription(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description) { + this._description = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description)arg).getDescription(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description]"); + } + + public String getDescription() { + return _description; + } + + + public L3ProtocolData1Builder setDescription(final String value) { + this._description = value; + return this; + } + + + @Override + public L3ProtocolData1 build() { + return new L3ProtocolData1Impl(this); + } + + private static final class L3ProtocolData1Impl + implements L3ProtocolData1 { + + private final String _description; + + L3ProtocolData1Impl(L3ProtocolData1Builder base) { + this._description = base.getDescription(); + } + + @Override + public String getDescription() { + return _description; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_description); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!L3ProtocolData1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + L3ProtocolData1 other = (L3ProtocolData1)obj; + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("L3ProtocolData1"); + CodeHelpers.appendValue(helper, "_description", _description); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/VirtualStorageDesc1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/VirtualStorageDesc1.java new file mode 100644 index 0000000000000000000000000000000000000000..63c4491432a1bc9e47b1eeff1131eedbb950222f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/VirtualStorageDesc1.java @@ -0,0 +1,23 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.additional.info.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDesc; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface VirtualStorageDesc1 + extends + Augmentation, + Description +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.additional.info.norev.VirtualStorageDesc1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/VirtualStorageDesc1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/VirtualStorageDesc1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..825c58a7c862d46e7fdfb144706b12726b405466 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/VirtualStorageDesc1Builder.java @@ -0,0 +1,157 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.additional.info.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualStorageDesc1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualStorageDesc1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualStorageDesc1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualStorageDesc1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualStorageDesc1Builder + * @see Builder + * + */ +public class VirtualStorageDesc1Builder implements Builder { + + private String _description; + + + + public VirtualStorageDesc1Builder() { + } + public VirtualStorageDesc1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description arg) { + this._description = arg.getDescription(); + } + + public VirtualStorageDesc1Builder(VirtualStorageDesc1 base) { + this._description = base.getDescription(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description) { + this._description = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description)arg).getDescription(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description]"); + } + + public String getDescription() { + return _description; + } + + + public VirtualStorageDesc1Builder setDescription(final String value) { + this._description = value; + return this; + } + + + @Override + public VirtualStorageDesc1 build() { + return new VirtualStorageDesc1Impl(this); + } + + private static final class VirtualStorageDesc1Impl + implements VirtualStorageDesc1 { + + private final String _description; + + VirtualStorageDesc1Impl(VirtualStorageDesc1Builder base) { + this._description = base.getDescription(); + } + + @Override + public String getDescription() { + return _description; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_description); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualStorageDesc1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualStorageDesc1 other = (VirtualStorageDesc1)obj; + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualStorageDesc1"); + CodeHelpers.appendValue(helper, "_description", _description); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/Vnfd1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/Vnfd1.java new file mode 100644 index 0000000000000000000000000000000000000000..277b1c1c422f956f369836a44dc798348138bcdd --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/Vnfd1.java @@ -0,0 +1,23 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.additional.info.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.Vnfd; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface Vnfd1 + extends + Augmentation, + Description +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.additional.info.norev.Vnfd1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/Vnfd1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/Vnfd1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..bd13491a0d7153697837fd8e13b5e4f5d7a13be7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/additional/info/norev/Vnfd1Builder.java @@ -0,0 +1,157 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.additional.info.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link Vnfd1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     Vnfd1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new Vnfd1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of Vnfd1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see Vnfd1Builder + * @see Builder + * + */ +public class Vnfd1Builder implements Builder { + + private String _description; + + + + public Vnfd1Builder() { + } + public Vnfd1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description arg) { + this._description = arg.getDescription(); + } + + public Vnfd1Builder(Vnfd1 base) { + this._description = base.getDescription(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description) { + this._description = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description)arg).getDescription(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.Description]"); + } + + public String getDescription() { + return _description; + } + + + public Vnfd1Builder setDescription(final String value) { + this._description = value; + return this; + } + + + @Override + public Vnfd1 build() { + return new Vnfd1Impl(this); + } + + private static final class Vnfd1Impl + implements Vnfd1 { + + private final String _description; + + Vnfd1Impl(Vnfd1Builder base) { + this._description = base.getDescription(); + } + + @Override + public String getDescription() { + return _description; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_description); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vnfd1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vnfd1 other = (Vnfd1)obj; + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vnfd1"); + CodeHelpers.appendValue(helper, "_description", _description); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..64b0114ba9a6f55a1515ce5665a64d81ef313dc4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9f5663fd53e3012951e631dacd232948e7aecb5e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/$YangModuleInfoImpl.java @@ -0,0 +1,48 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:osm:yang:augments:alarm", "alarm").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.$YangModuleInfoImpl.getInstance()); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/alarm.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/ExtendedAlarm.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/ExtendedAlarm.java new file mode 100644 index 0000000000000000000000000000000000000000..62bd6609636cf9f2337719a1799fc4f873f33eaa --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/ExtendedAlarm.java @@ -0,0 +1,61 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.extended.alarm.Alarm; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.extended.alarm.AlarmKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module alarm + *

+ * grouping extended-alarm {
+ *   list alarm {
+ *     key alarm-id;
+ *     leaf alarm-id {
+ *       type string;
+ *     }
+ *     leaf vnf-monitoring-param-ref {
+ *       type leafref {
+ *         path /vnfd:vnfd/vnfd:df/vnfd:monitoring-parameter/vnfd:id;
+ *       }
+ *     }
+ *     uses common:alarm-properties;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * alarm/extended-alarm + * + */ +public interface ExtendedAlarm + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-alarm"); + + @Override + Class implementedInterface(); + + /** + * @return java.util.Map alarm, or null if not present + */ + @Nullable Map getAlarm(); + + /** + * @return java.util.Map alarm, or an empty list if it is not present + */ + default @NonNull Map nonnullAlarm() { + return CodeHelpers.nonnull(getAlarm()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/Vdu1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/Vdu1.java new file mode 100644 index 0000000000000000000000000000000000000000..cda1b04985597b2e027430e0a07d400cafdaca05 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/Vdu1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface Vdu1 + extends + Augmentation, + ExtendedAlarm +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.Vdu1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/Vdu1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/Vdu1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..72edd2886558a672e15d52a0cae49a6969bb046c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/Vdu1Builder.java @@ -0,0 +1,179 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev; +import com.google.common.base.MoreObjects; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.extended.alarm.Alarm; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.extended.alarm.AlarmKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link Vdu1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     Vdu1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new Vdu1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of Vdu1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see Vdu1Builder + * @see Builder + * + */ +public class Vdu1Builder implements Builder { + + private Map _alarm; + + + + public Vdu1Builder() { + } + public Vdu1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.ExtendedAlarm arg) { + this._alarm = arg.getAlarm(); + } + + public Vdu1Builder(Vdu1 base) { + this._alarm = base.getAlarm(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.ExtendedAlarm
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.ExtendedAlarm) { + this._alarm = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.ExtendedAlarm)arg).getAlarm(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.ExtendedAlarm]"); + } + + public Map getAlarm() { + return _alarm; + } + + public Vdu1Builder setAlarm(final Map values) { + this._alarm = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setAlarm(Map)} instead. + */ + @Deprecated(forRemoval = true) + public Vdu1Builder setAlarm(final List values) { + return setAlarm(CodeHelpers.compatMap(values)); + } + + + @Override + public Vdu1 build() { + return new Vdu1Impl(this); + } + + private static final class Vdu1Impl + implements Vdu1 { + + private final Map _alarm; + + Vdu1Impl(Vdu1Builder base) { + this._alarm = CodeHelpers.emptyToNull(base.getAlarm()); + } + + @Override + public Map getAlarm() { + return _alarm; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_alarm); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vdu1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vdu1 other = (Vdu1)obj; + if (!Objects.equals(_alarm, other.getAlarm())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vdu1"); + CodeHelpers.appendValue(helper, "_alarm", _alarm); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/extended/alarm/Alarm.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/extended/alarm/Alarm.java new file mode 100644 index 0000000000000000000000000000000000000000..081de406de096ddfbabe0cdcd947963abdb378fa --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/extended/alarm/Alarm.java @@ -0,0 +1,79 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.extended.alarm; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.ExtendedAlarm; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module alarm + *

+ * list alarm {
+ *   key alarm-id;
+ *   leaf alarm-id {
+ *     type string;
+ *   }
+ *   leaf vnf-monitoring-param-ref {
+ *     type leafref {
+ *       path /vnfd:vnfd/vnfd:df/vnfd:monitoring-parameter/vnfd:id;
+ *     }
+ *   }
+ *   uses common:alarm-properties;
+ * }
+ * 
The schema path to identify an instance is + * alarm/extended-alarm/alarm + * + *

To create instances of this class use {@link AlarmBuilder}. + * @see AlarmBuilder + * @see AlarmKey + * + */ +public interface Alarm + extends + ChildOf, + Augmentable, + AlarmProperties, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("alarm"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.extended.alarm.Alarm.class; + } + + /** + * This field is reserved for the identifier assigned by the VIM provider + * + * + * + * @return java.lang.String alarmId, or null if not present + */ + @Nullable String getAlarmId(); + + /** + * Reference to the VNF level monitoring parameter that is aggregated + * + * + * + * @return java.lang.String vnfMonitoringParamRef, or null if not present + */ + @Nullable String getVnfMonitoringParamRef(); + + @Override + AlarmKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/extended/alarm/AlarmBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/extended/alarm/AlarmBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..bc3d6ee4a27542860f3684c8bf81384fc0b00950 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/extended/alarm/AlarmBuilder.java @@ -0,0 +1,625 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.extended.alarm; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigDecimal; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmSeverityType; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmStatisticType; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.RelationalOperationType; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.Actions; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * Class that builds {@link AlarmBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AlarmBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AlarmBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AlarmBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AlarmBuilder + * @see Builder + * + */ +public class AlarmBuilder implements Builder { + + private Actions _actions; + private String _alarmId; + private String _description; + private Uint32 _evaluations; + private String _name; + private RelationalOperationType _operation; + private Uint32 _period; + private AlarmSeverityType _severity; + private AlarmStatisticType _statistic; + private BigDecimal _value; + private String _vdurId; + private String _vnfMonitoringParamRef; + private Boolean _enabled; + private Boolean _repeat; + private AlarmKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AlarmBuilder() { + } + public AlarmBuilder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties arg) { + this._name = arg.getName(); + this._description = arg.getDescription(); + this._vdurId = arg.getVdurId(); + this._actions = arg.getActions(); + this._repeat = arg.isRepeat(); + this._enabled = arg.isEnabled(); + this._severity = arg.getSeverity(); + this._statistic = arg.getStatistic(); + this._operation = arg.getOperation(); + this._value = arg.getValue(); + this._period = arg.getPeriod(); + this._evaluations = arg.getEvaluations(); + } + + public AlarmBuilder(Alarm base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._alarmId = base.getAlarmId(); + this._actions = base.getActions(); + this._description = base.getDescription(); + this._evaluations = base.getEvaluations(); + this._name = base.getName(); + this._operation = base.getOperation(); + this._period = base.getPeriod(); + this._severity = base.getSeverity(); + this._statistic = base.getStatistic(); + this._value = base.getValue(); + this._vdurId = base.getVdurId(); + this._vnfMonitoringParamRef = base.getVnfMonitoringParamRef(); + this._enabled = base.isEnabled(); + this._repeat = base.isRepeat(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties) { + this._name = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).getName(); + this._description = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).getDescription(); + this._vdurId = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).getVdurId(); + this._actions = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).getActions(); + this._repeat = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).isRepeat(); + this._enabled = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).isEnabled(); + this._severity = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).getSeverity(); + this._statistic = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).getStatistic(); + this._operation = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).getOperation(); + this._value = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).getValue(); + this._period = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).getPeriod(); + this._evaluations = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties)arg).getEvaluations(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties]"); + } + + public AlarmKey key() { + return key; + } + + public Actions getActions() { + return _actions; + } + + public String getAlarmId() { + return _alarmId; + } + + public String getDescription() { + return _description; + } + + public Uint32 getEvaluations() { + return _evaluations; + } + + public String getName() { + return _name; + } + + public RelationalOperationType getOperation() { + return _operation; + } + + public Uint32 getPeriod() { + return _period; + } + + public AlarmSeverityType getSeverity() { + return _severity; + } + + public AlarmStatisticType getStatistic() { + return _statistic; + } + + public BigDecimal getValue() { + return _value; + } + + public String getVdurId() { + return _vdurId; + } + + public String getVnfMonitoringParamRef() { + return _vnfMonitoringParamRef; + } + + public Boolean isEnabled() { + return _enabled; + } + + public Boolean isRepeat() { + return _repeat; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AlarmBuilder withKey(final AlarmKey key) { + this.key = key; + return this; + } + + public AlarmBuilder setActions(final Actions value) { + this._actions = value; + return this; + } + + public AlarmBuilder setAlarmId(final String value) { + this._alarmId = value; + return this; + } + + public AlarmBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public AlarmBuilder setEvaluations(final Uint32 value) { + this._evaluations = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setEvaluations(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public AlarmBuilder setEvaluations(final Long value) { + return setEvaluations(CodeHelpers.compatUint(value)); + } + + public AlarmBuilder setName(final String value) { + this._name = value; + return this; + } + + public AlarmBuilder setOperation(final RelationalOperationType value) { + this._operation = value; + return this; + } + + public AlarmBuilder setPeriod(final Uint32 value) { + this._period = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setPeriod(Uint32)} instead. + */ + @Deprecated(forRemoval = true) + public AlarmBuilder setPeriod(final Long value) { + return setPeriod(CodeHelpers.compatUint(value)); + } + + public AlarmBuilder setSeverity(final AlarmSeverityType value) { + this._severity = value; + return this; + } + + public AlarmBuilder setStatistic(final AlarmStatisticType value) { + this._statistic = value; + return this; + } + + + public AlarmBuilder setValue(final BigDecimal value) { + if (value != null) { + + } + this._value = value; + return this; + } + + public AlarmBuilder setVdurId(final String value) { + this._vdurId = value; + return this; + } + + public AlarmBuilder setVnfMonitoringParamRef(final String value) { + this._vnfMonitoringParamRef = value; + return this; + } + + public AlarmBuilder setEnabled(final Boolean value) { + this._enabled = value; + return this; + } + + public AlarmBuilder setRepeat(final Boolean value) { + this._repeat = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AlarmBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AlarmBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AlarmBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AlarmBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Alarm build() { + return new AlarmImpl(this); + } + + private static final class AlarmImpl + extends AbstractAugmentable + implements Alarm { + + private final Actions _actions; + private final String _alarmId; + private final String _description; + private final Uint32 _evaluations; + private final String _name; + private final RelationalOperationType _operation; + private final Uint32 _period; + private final AlarmSeverityType _severity; + private final AlarmStatisticType _statistic; + private final BigDecimal _value; + private final String _vdurId; + private final String _vnfMonitoringParamRef; + private final Boolean _enabled; + private final Boolean _repeat; + private final AlarmKey key; + + AlarmImpl(AlarmBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new AlarmKey(base.getAlarmId()); + } + this._alarmId = key.getAlarmId(); + this._actions = base.getActions(); + this._description = base.getDescription(); + this._evaluations = base.getEvaluations(); + this._name = base.getName(); + this._operation = base.getOperation(); + this._period = base.getPeriod(); + this._severity = base.getSeverity(); + this._statistic = base.getStatistic(); + this._value = base.getValue(); + this._vdurId = base.getVdurId(); + this._vnfMonitoringParamRef = base.getVnfMonitoringParamRef(); + this._enabled = base.isEnabled(); + this._repeat = base.isRepeat(); + } + + @Override + public AlarmKey key() { + return key; + } + + @Override + public Actions getActions() { + return _actions; + } + + @Override + public String getAlarmId() { + return _alarmId; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public Uint32 getEvaluations() { + return _evaluations; + } + + @Override + public String getName() { + return _name; + } + + @Override + public RelationalOperationType getOperation() { + return _operation; + } + + @Override + public Uint32 getPeriod() { + return _period; + } + + @Override + public AlarmSeverityType getSeverity() { + return _severity; + } + + @Override + public AlarmStatisticType getStatistic() { + return _statistic; + } + + @Override + public BigDecimal getValue() { + return _value; + } + + @Override + public String getVdurId() { + return _vdurId; + } + + @Override + public String getVnfMonitoringParamRef() { + return _vnfMonitoringParamRef; + } + + @Override + public Boolean isEnabled() { + return _enabled; + } + + @Override + public Boolean isRepeat() { + return _repeat; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_actions); + result = prime * result + Objects.hashCode(_alarmId); + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_evaluations); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_operation); + result = prime * result + Objects.hashCode(_period); + result = prime * result + Objects.hashCode(_severity); + result = prime * result + Objects.hashCode(_statistic); + result = prime * result + Objects.hashCode(_value); + result = prime * result + Objects.hashCode(_vdurId); + result = prime * result + Objects.hashCode(_vnfMonitoringParamRef); + result = prime * result + Objects.hashCode(_enabled); + result = prime * result + Objects.hashCode(_repeat); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Alarm.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Alarm other = (Alarm)obj; + if (!Objects.equals(_actions, other.getActions())) { + return false; + } + if (!Objects.equals(_alarmId, other.getAlarmId())) { + return false; + } + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_evaluations, other.getEvaluations())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_operation, other.getOperation())) { + return false; + } + if (!Objects.equals(_period, other.getPeriod())) { + return false; + } + if (!Objects.equals(_severity, other.getSeverity())) { + return false; + } + if (!Objects.equals(_statistic, other.getStatistic())) { + return false; + } + if (!Objects.equals(_value, other.getValue())) { + return false; + } + if (!Objects.equals(_vdurId, other.getVdurId())) { + return false; + } + if (!Objects.equals(_vnfMonitoringParamRef, other.getVnfMonitoringParamRef())) { + return false; + } + if (!Objects.equals(_enabled, other.isEnabled())) { + return false; + } + if (!Objects.equals(_repeat, other.isRepeat())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AlarmImpl otherImpl = (AlarmImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Alarm"); + CodeHelpers.appendValue(helper, "_actions", _actions); + CodeHelpers.appendValue(helper, "_alarmId", _alarmId); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_evaluations", _evaluations); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_operation", _operation); + CodeHelpers.appendValue(helper, "_period", _period); + CodeHelpers.appendValue(helper, "_severity", _severity); + CodeHelpers.appendValue(helper, "_statistic", _statistic); + CodeHelpers.appendValue(helper, "_value", _value); + CodeHelpers.appendValue(helper, "_vdurId", _vdurId); + CodeHelpers.appendValue(helper, "_vnfMonitoringParamRef", _vnfMonitoringParamRef); + CodeHelpers.appendValue(helper, "_enabled", _enabled); + CodeHelpers.appendValue(helper, "_repeat", _repeat); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/extended/alarm/AlarmKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/extended/alarm/AlarmKey.java new file mode 100644 index 0000000000000000000000000000000000000000..b0e48e96fd8e52090f86beea37c3c16f1e30b18b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/alarm/norev/extended/alarm/AlarmKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.alarm.norev.extended.alarm; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class AlarmKey + implements Identifier { + private static final long serialVersionUID = 6949511475175144069L; + private final String _alarmId; + + + public AlarmKey(String _alarmId) { + + this._alarmId = _alarmId; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public AlarmKey(AlarmKey source) { + this._alarmId = source._alarmId; + } + + + public String getAlarmId() { + return _alarmId; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_alarmId); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof AlarmKey)) { + return false; + } + final AlarmKey other = (AlarmKey) obj; + if (!Objects.equals(_alarmId, other._alarmId)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(AlarmKey.class); + CodeHelpers.appendValue(helper, "_alarmId", _alarmId); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..c256d71a4f5d496d907e32e19e5503146183a71c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..932f1f43d5fe7df773c702d286d04fbdc750cab3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/$YangModuleInfoImpl.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:osm:yang:augments:cloud-init", "cloud-init").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/cloud-init.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/ExtendedCloudInit.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/ExtendedCloudInit.java new file mode 100644 index 0000000000000000000000000000000000000000..7736e64c9005caede69974683a5b77f2d75a4b31 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/ExtendedCloudInit.java @@ -0,0 +1,56 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init.CloudInitInput; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module cloud-init + *

+ * grouping extended-cloud-init {
+ *   choice cloud-init-input {
+ *     case inline {
+ *       leaf cloud-init {
+ *         type string;
+ *       }
+ *     }
+ *     case filename {
+ *       leaf cloud-init-file {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * cloud-init/extended-cloud-init + * + */ +public interface ExtendedCloudInit + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-cloud-init"); + + @Override + Class implementedInterface(); + + /** + * Indicates how the contents of cloud-init script are provided. There are 2 + * choices - inline or in a file + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init.CloudInitInput cloudInitInput, or null if not present + */ + @Nullable CloudInitInput getCloudInitInput(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/Vdu1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/Vdu1.java new file mode 100644 index 0000000000000000000000000000000000000000..d9d17a1e9cc9f18a6304eec48697b36481c780a0 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/Vdu1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.Vdu; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface Vdu1 + extends + Augmentation, + ExtendedCloudInit +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.Vdu1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/Vdu1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/Vdu1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..ffd59a74dd5a1d508e73a25f5f77879818c8b72f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/Vdu1Builder.java @@ -0,0 +1,158 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init.CloudInitInput; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link Vdu1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     Vdu1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new Vdu1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of Vdu1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see Vdu1Builder + * @see Builder + * + */ +public class Vdu1Builder implements Builder { + + private CloudInitInput _cloudInitInput; + + + + public Vdu1Builder() { + } + public Vdu1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.ExtendedCloudInit arg) { + this._cloudInitInput = arg.getCloudInitInput(); + } + + public Vdu1Builder(Vdu1 base) { + this._cloudInitInput = base.getCloudInitInput(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.ExtendedCloudInit
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.ExtendedCloudInit) { + this._cloudInitInput = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.ExtendedCloudInit)arg).getCloudInitInput(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.ExtendedCloudInit]"); + } + + public CloudInitInput getCloudInitInput() { + return _cloudInitInput; + } + + + public Vdu1Builder setCloudInitInput(final CloudInitInput value) { + this._cloudInitInput = value; + return this; + } + + + @Override + public Vdu1 build() { + return new Vdu1Impl(this); + } + + private static final class Vdu1Impl + implements Vdu1 { + + private final CloudInitInput _cloudInitInput; + + Vdu1Impl(Vdu1Builder base) { + this._cloudInitInput = base.getCloudInitInput(); + } + + @Override + public CloudInitInput getCloudInitInput() { + return _cloudInitInput; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cloudInitInput); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vdu1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vdu1 other = (Vdu1)obj; + if (!Objects.equals(_cloudInitInput, other.getCloudInitInput())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vdu1"); + CodeHelpers.appendValue(helper, "_cloudInitInput", _cloudInitInput); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/CloudInitInput.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/CloudInitInput.java new file mode 100644 index 0000000000000000000000000000000000000000..43b32329df5b30327b695857b602a74f5af2710c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/CloudInitInput.java @@ -0,0 +1,42 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.ExtendedCloudInit; +import org.opendaylight.yangtools.yang.binding.ChoiceIn; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Indicates how the contents of cloud-init script are provided. There are 2 + * choices - inline or in a file + * + *

+ * This class represents the following YANG schema fragment defined in module cloud-init + *

+ * choice cloud-init-input {
+ *   case inline {
+ *     leaf cloud-init {
+ *       type string;
+ *     }
+ *   }
+ *   case filename {
+ *     leaf cloud-init-file {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * cloud-init/extended-cloud-init/cloud-init-input + * + */ +public interface CloudInitInput + extends + ChoiceIn +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("cloud-init-input"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/Filename.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/Filename.java new file mode 100644 index 0000000000000000000000000000000000000000..95bad0e6986fd682e7d1e5d5b64f62514708ebf9 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/Filename.java @@ -0,0 +1,53 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init.cloud.init.input; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init.CloudInitInput; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module cloud-init + *

+ * case filename {
+ *   leaf cloud-init-file {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * cloud-init/extended-cloud-init/cloud-init-input/filename + * + */ +public interface Filename + extends + DataObject, + Augmentable, + CloudInitInput +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("filename"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init.cloud.init.input.Filename.class; + } + + /** + * Name of file with contents of cloud-init script in cloud-config format + * + * + * + * @return java.lang.String cloudInitFile, or null if not present + */ + @Nullable String getCloudInitFile(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/FilenameBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/FilenameBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..2cbeba25d7e62074216b6c328cc7cec625abe5cc --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/FilenameBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init.cloud.init.input; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link FilenameBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     FilenameBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new FilenameBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of FilenameBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see FilenameBuilder + * @see Builder + * + */ +public class FilenameBuilder implements Builder { + + private String _cloudInitFile; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public FilenameBuilder() { + } + + public FilenameBuilder(Filename base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._cloudInitFile = base.getCloudInitFile(); + } + + + public String getCloudInitFile() { + return _cloudInitFile; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public FilenameBuilder setCloudInitFile(final String value) { + this._cloudInitFile = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public FilenameBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public FilenameBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public FilenameBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private FilenameBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Filename build() { + return new FilenameImpl(this); + } + + private static final class FilenameImpl + extends AbstractAugmentable + implements Filename { + + private final String _cloudInitFile; + + FilenameImpl(FilenameBuilder base) { + super(base.augmentation); + this._cloudInitFile = base.getCloudInitFile(); + } + + @Override + public String getCloudInitFile() { + return _cloudInitFile; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cloudInitFile); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Filename.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Filename other = (Filename)obj; + if (!Objects.equals(_cloudInitFile, other.getCloudInitFile())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + FilenameImpl otherImpl = (FilenameImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Filename"); + CodeHelpers.appendValue(helper, "_cloudInitFile", _cloudInitFile); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/Inline.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/Inline.java new file mode 100644 index 0000000000000000000000000000000000000000..9de1352d83c9a6c042b03c875edab009db9c780a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/Inline.java @@ -0,0 +1,53 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init.cloud.init.input; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init.CloudInitInput; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module cloud-init + *

+ * case inline {
+ *   leaf cloud-init {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * cloud-init/extended-cloud-init/cloud-init-input/inline + * + */ +public interface Inline + extends + DataObject, + Augmentable, + CloudInitInput +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("inline"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init.cloud.init.input.Inline.class; + } + + /** + * Contents of cloud-init script, provided inline, in cloud-config format + * + * + * + * @return java.lang.String cloudInit, or null if not present + */ + @Nullable String getCloudInit(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/InlineBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/InlineBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..622f614159946387a97d6e3c8f739c670b0efc1f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/cloud/init/norev/extended/cloud/init/cloud/init/input/InlineBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.cloud.init.norev.extended.cloud.init.cloud.init.input; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link InlineBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     InlineBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new InlineBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of InlineBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see InlineBuilder + * @see Builder + * + */ +public class InlineBuilder implements Builder { + + private String _cloudInit; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public InlineBuilder() { + } + + public InlineBuilder(Inline base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._cloudInit = base.getCloudInit(); + } + + + public String getCloudInit() { + return _cloudInit; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public InlineBuilder setCloudInit(final String value) { + this._cloudInit = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public InlineBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public InlineBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public InlineBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private InlineBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Inline build() { + return new InlineImpl(this); + } + + private static final class InlineImpl + extends AbstractAugmentable + implements Inline { + + private final String _cloudInit; + + InlineImpl(InlineBuilder base) { + super(base.augmentation); + this._cloudInit = base.getCloudInit(); + } + + @Override + public String getCloudInit() { + return _cloudInit; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cloudInit); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Inline.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Inline other = (Inline)obj; + if (!Objects.equals(_cloudInit, other.getCloudInit())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + InlineImpl otherImpl = (InlineImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Inline"); + CodeHelpers.appendValue(helper, "_cloudInit", _cloudInit); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..d894dc6c9a997373ebadfe43b5053c2a9e118cde --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..500052ce2d274ce562e0a90c056d817120ad6513 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/$YangModuleInfoImpl.java @@ -0,0 +1,48 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:osm:yang:augments:day1-2", "day1-2").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.$YangModuleInfoImpl.getInstance()); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/day1-2.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/ExtendedVnfConfiguration.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/ExtendedVnfConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..cb43a8110e6d342db3088150c120fe71057c8805 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/ExtendedVnfConfiguration.java @@ -0,0 +1,64 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.extended.vnf.configuration.Day12; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.extended.vnf.configuration.Day12Key; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module day1-2 + *

+ * grouping extended-vnf-configuration {
+ *   list day1-2 {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     uses common:vnfc-configuration;
+ *     uses common:vnfc-relations;
+ *     uses common:vdu-config-access;
+ *     leaf-list blacklist-config-primitive {
+ *       type enumeration {
+ *         enum upgrade;
+ *         enum rollback;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * day1-2/extended-vnf-configuration + * + */ +public interface ExtendedVnfConfiguration + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-vnf-configuration"); + + @Override + Class implementedInterface(); + + /** + * @return java.util.Map day12, or null if not present + */ + @Nullable Map getDay12(); + + /** + * @return java.util.Map day12, or an empty list if it is not present + */ + default @NonNull Map nonnullDay12() { + return CodeHelpers.nonnull(getDay12()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/OperateVnfOpConfig1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/OperateVnfOpConfig1.java new file mode 100644 index 0000000000000000000000000000000000000000..32afdd0cc85e380194514aa0327382596e135812 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/OperateVnfOpConfig1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.df.lcm.operations.configuration.OperateVnfOpConfig; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface OperateVnfOpConfig1 + extends + Augmentation, + ExtendedVnfConfiguration +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.OperateVnfOpConfig1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/OperateVnfOpConfig1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/OperateVnfOpConfig1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..34c88b1e8c85d3f7aae2074f7e43714544e1a38c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/OperateVnfOpConfig1Builder.java @@ -0,0 +1,179 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev; +import com.google.common.base.MoreObjects; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.extended.vnf.configuration.Day12; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.extended.vnf.configuration.Day12Key; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link OperateVnfOpConfig1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     OperateVnfOpConfig1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new OperateVnfOpConfig1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of OperateVnfOpConfig1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see OperateVnfOpConfig1Builder + * @see Builder + * + */ +public class OperateVnfOpConfig1Builder implements Builder { + + private Map _day12; + + + + public OperateVnfOpConfig1Builder() { + } + public OperateVnfOpConfig1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.ExtendedVnfConfiguration arg) { + this._day12 = arg.getDay12(); + } + + public OperateVnfOpConfig1Builder(OperateVnfOpConfig1 base) { + this._day12 = base.getDay12(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.ExtendedVnfConfiguration
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.ExtendedVnfConfiguration) { + this._day12 = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.ExtendedVnfConfiguration)arg).getDay12(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.ExtendedVnfConfiguration]"); + } + + public Map getDay12() { + return _day12; + } + + public OperateVnfOpConfig1Builder setDay12(final Map values) { + this._day12 = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setDay12(Map)} instead. + */ + @Deprecated(forRemoval = true) + public OperateVnfOpConfig1Builder setDay12(final List values) { + return setDay12(CodeHelpers.compatMap(values)); + } + + + @Override + public OperateVnfOpConfig1 build() { + return new OperateVnfOpConfig1Impl(this); + } + + private static final class OperateVnfOpConfig1Impl + implements OperateVnfOpConfig1 { + + private final Map _day12; + + OperateVnfOpConfig1Impl(OperateVnfOpConfig1Builder base) { + this._day12 = CodeHelpers.emptyToNull(base.getDay12()); + } + + @Override + public Map getDay12() { + return _day12; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_day12); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!OperateVnfOpConfig1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + OperateVnfOpConfig1 other = (OperateVnfOpConfig1)obj; + if (!Objects.equals(_day12, other.getDay12())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("OperateVnfOpConfig1"); + CodeHelpers.appendValue(helper, "_day12", _day12); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/extended/vnf/configuration/Day12.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/extended/vnf/configuration/Day12.java new file mode 100644 index 0000000000000000000000000000000000000000..737990d3b156d06cdb7b7a2d30e1335c0f915e95 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/extended/vnf/configuration/Day12.java @@ -0,0 +1,155 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.extended.vnf.configuration; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.ExtendedVnfConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VduConfigAccess; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcConfiguration; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcRelations; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module day1-2 + *

+ * list day1-2 {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ *   uses common:vnfc-configuration;
+ *   uses common:vnfc-relations;
+ *   uses common:vdu-config-access;
+ *   leaf-list blacklist-config-primitive {
+ *     type enumeration {
+ *       enum upgrade;
+ *       enum rollback;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * day1-2/extended-vnf-configuration/day1-2 + * + *

To create instances of this class use {@link Day12Builder}. + * @see Day12Builder + * @see Day12Key + * + */ +public interface Day12 + extends + ChildOf, + Augmentable, + VnfcConfiguration, + VnfcRelations, + VduConfigAccess, + Identifiable +{ + + + public enum BlacklistConfigPrimitive implements Enumeration { + Upgrade(0, "upgrade"), + + Rollback(1, "rollback") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (BlacklistConfigPrimitive enumItem : BlacklistConfigPrimitive.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private BlacklistConfigPrimitive(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding BlacklistConfigPrimitive item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding BlacklistConfigPrimitive item, or null if no such item exists + */ + public static BlacklistConfigPrimitive forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("day1-2"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.extended.vnf.configuration.Day12.class; + } + + /** + * Internal identifier for the VNF/VDU/KNF/KDU configuration + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + /** + * List of blacklisted config primitives from the list of default kdu config + * primitives + * + * + * + * @return java.util.List blacklistConfigPrimitive, or null if not present + */ + @Nullable List getBlacklistConfigPrimitive(); + + @Override + Day12Key key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/extended/vnf/configuration/Day12Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/extended/vnf/configuration/Day12Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..5656116fe54d3ee6629f065a069b1118a91ae37f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/extended/vnf/configuration/Day12Builder.java @@ -0,0 +1,588 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.extended.vnf.configuration; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.ConfigMethod; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vdu.config.access.ConfigAccess; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.ConfigPrimitive; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.ConfigPrimitiveKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.InitialConfigPrimitive; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.InitialConfigPrimitiveKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.TerminateConfigPrimitive; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.TerminateConfigPrimitiveKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.metrics.Metrics; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.metrics.MetricsKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.relations.Relation; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.relations.RelationKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link Day12Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     Day12Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new Day12BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of Day12Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see Day12Builder + * @see Builder + * + */ +public class Day12Builder implements Builder { + + private List _blacklistConfigPrimitive; + private ConfigAccess _configAccess; + private ConfigMethod _configMethod; + private Map _configPrimitive; + private String _id; + private Map _initialConfigPrimitive; + private Map _metrics; + private Map _relation; + private Map _terminateConfigPrimitive; + private Day12Key key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public Day12Builder() { + } + public Day12Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcConfiguration arg) { + this._configPrimitive = arg.getConfigPrimitive(); + this._initialConfigPrimitive = arg.getInitialConfigPrimitive(); + this._terminateConfigPrimitive = arg.getTerminateConfigPrimitive(); + this._configMethod = arg.getConfigMethod(); + this._metrics = arg.getMetrics(); + } + public Day12Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.ConfigurationMethod arg) { + this._configMethod = arg.getConfigMethod(); + } + public Day12Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcMetrics arg) { + this._metrics = arg.getMetrics(); + } + public Day12Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcRelations arg) { + this._relation = arg.getRelation(); + } + public Day12Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VduConfigAccess arg) { + this._configAccess = arg.getConfigAccess(); + } + + public Day12Builder(Day12 base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._blacklistConfigPrimitive = base.getBlacklistConfigPrimitive(); + this._configAccess = base.getConfigAccess(); + this._configMethod = base.getConfigMethod(); + this._configPrimitive = base.getConfigPrimitive(); + this._initialConfigPrimitive = base.getInitialConfigPrimitive(); + this._metrics = base.getMetrics(); + this._relation = base.getRelation(); + this._terminateConfigPrimitive = base.getTerminateConfigPrimitive(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcMetrics
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.ConfigurationMethod
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcRelations
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcConfiguration
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VduConfigAccess
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcMetrics) { + this._metrics = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcMetrics)arg).getMetrics(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.ConfigurationMethod) { + this._configMethod = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.ConfigurationMethod)arg).getConfigMethod(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcRelations) { + this._relation = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcRelations)arg).getRelation(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcConfiguration) { + this._configPrimitive = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcConfiguration)arg).getConfigPrimitive(); + this._initialConfigPrimitive = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcConfiguration)arg).getInitialConfigPrimitive(); + this._terminateConfigPrimitive = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcConfiguration)arg).getTerminateConfigPrimitive(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VduConfigAccess) { + this._configAccess = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VduConfigAccess)arg).getConfigAccess(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcMetrics, org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.ConfigurationMethod, org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcRelations, org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VnfcConfiguration, org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.VduConfigAccess]"); + } + + public Day12Key key() { + return key; + } + + public List getBlacklistConfigPrimitive() { + return _blacklistConfigPrimitive; + } + + public ConfigAccess getConfigAccess() { + return _configAccess; + } + + public ConfigMethod getConfigMethod() { + return _configMethod; + } + + public Map getConfigPrimitive() { + return _configPrimitive; + } + + public String getId() { + return _id; + } + + public Map getInitialConfigPrimitive() { + return _initialConfigPrimitive; + } + + public Map getMetrics() { + return _metrics; + } + + public Map getRelation() { + return _relation; + } + + public Map getTerminateConfigPrimitive() { + return _terminateConfigPrimitive; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public Day12Builder withKey(final Day12Key key) { + this.key = key; + return this; + } + public Day12Builder setBlacklistConfigPrimitive(final List values) { + this._blacklistConfigPrimitive = values; + return this; + } + + + public Day12Builder setConfigAccess(final ConfigAccess value) { + this._configAccess = value; + return this; + } + + public Day12Builder setConfigMethod(final ConfigMethod value) { + this._configMethod = value; + return this; + } + public Day12Builder setConfigPrimitive(final Map values) { + this._configPrimitive = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setConfigPrimitive(Map)} instead. + */ + @Deprecated(forRemoval = true) + public Day12Builder setConfigPrimitive(final List values) { + return setConfigPrimitive(CodeHelpers.compatMap(values)); + } + + public Day12Builder setId(final String value) { + this._id = value; + return this; + } + public Day12Builder setInitialConfigPrimitive(final Map values) { + this._initialConfigPrimitive = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setInitialConfigPrimitive(Map)} instead. + */ + @Deprecated(forRemoval = true) + public Day12Builder setInitialConfigPrimitive(final List values) { + return setInitialConfigPrimitive(CodeHelpers.compatMap(values)); + } + public Day12Builder setMetrics(final Map values) { + this._metrics = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setMetrics(Map)} instead. + */ + @Deprecated(forRemoval = true) + public Day12Builder setMetrics(final List values) { + return setMetrics(CodeHelpers.compatMap(values)); + } + public Day12Builder setRelation(final Map values) { + this._relation = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setRelation(Map)} instead. + */ + @Deprecated(forRemoval = true) + public Day12Builder setRelation(final List values) { + return setRelation(CodeHelpers.compatMap(values)); + } + public Day12Builder setTerminateConfigPrimitive(final Map values) { + this._terminateConfigPrimitive = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setTerminateConfigPrimitive(Map)} instead. + */ + @Deprecated(forRemoval = true) + public Day12Builder setTerminateConfigPrimitive(final List values) { + return setTerminateConfigPrimitive(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public Day12Builder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public Day12Builder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public Day12Builder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private Day12Builder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Day12 build() { + return new Day12Impl(this); + } + + private static final class Day12Impl + extends AbstractAugmentable + implements Day12 { + + private final List _blacklistConfigPrimitive; + private final ConfigAccess _configAccess; + private final ConfigMethod _configMethod; + private final Map _configPrimitive; + private final String _id; + private final Map _initialConfigPrimitive; + private final Map _metrics; + private final Map _relation; + private final Map _terminateConfigPrimitive; + private final Day12Key key; + + Day12Impl(Day12Builder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new Day12Key(base.getId()); + } + this._id = key.getId(); + this._blacklistConfigPrimitive = base.getBlacklistConfigPrimitive(); + this._configAccess = base.getConfigAccess(); + this._configMethod = base.getConfigMethod(); + this._configPrimitive = CodeHelpers.emptyToNull(base.getConfigPrimitive()); + this._initialConfigPrimitive = CodeHelpers.emptyToNull(base.getInitialConfigPrimitive()); + this._metrics = CodeHelpers.emptyToNull(base.getMetrics()); + this._relation = CodeHelpers.emptyToNull(base.getRelation()); + this._terminateConfigPrimitive = CodeHelpers.emptyToNull(base.getTerminateConfigPrimitive()); + } + + @Override + public Day12Key key() { + return key; + } + + @Override + public List getBlacklistConfigPrimitive() { + return _blacklistConfigPrimitive; + } + + @Override + public ConfigAccess getConfigAccess() { + return _configAccess; + } + + @Override + public ConfigMethod getConfigMethod() { + return _configMethod; + } + + @Override + public Map getConfigPrimitive() { + return _configPrimitive; + } + + @Override + public String getId() { + return _id; + } + + @Override + public Map getInitialConfigPrimitive() { + return _initialConfigPrimitive; + } + + @Override + public Map getMetrics() { + return _metrics; + } + + @Override + public Map getRelation() { + return _relation; + } + + @Override + public Map getTerminateConfigPrimitive() { + return _terminateConfigPrimitive; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_blacklistConfigPrimitive); + result = prime * result + Objects.hashCode(_configAccess); + result = prime * result + Objects.hashCode(_configMethod); + result = prime * result + Objects.hashCode(_configPrimitive); + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_initialConfigPrimitive); + result = prime * result + Objects.hashCode(_metrics); + result = prime * result + Objects.hashCode(_relation); + result = prime * result + Objects.hashCode(_terminateConfigPrimitive); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Day12.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Day12 other = (Day12)obj; + if (!Objects.equals(_blacklistConfigPrimitive, other.getBlacklistConfigPrimitive())) { + return false; + } + if (!Objects.equals(_configAccess, other.getConfigAccess())) { + return false; + } + if (!Objects.equals(_configMethod, other.getConfigMethod())) { + return false; + } + if (!Objects.equals(_configPrimitive, other.getConfigPrimitive())) { + return false; + } + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_initialConfigPrimitive, other.getInitialConfigPrimitive())) { + return false; + } + if (!Objects.equals(_metrics, other.getMetrics())) { + return false; + } + if (!Objects.equals(_relation, other.getRelation())) { + return false; + } + if (!Objects.equals(_terminateConfigPrimitive, other.getTerminateConfigPrimitive())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + Day12Impl otherImpl = (Day12Impl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Day12"); + CodeHelpers.appendValue(helper, "_blacklistConfigPrimitive", _blacklistConfigPrimitive); + CodeHelpers.appendValue(helper, "_configAccess", _configAccess); + CodeHelpers.appendValue(helper, "_configMethod", _configMethod); + CodeHelpers.appendValue(helper, "_configPrimitive", _configPrimitive); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_initialConfigPrimitive", _initialConfigPrimitive); + CodeHelpers.appendValue(helper, "_metrics", _metrics); + CodeHelpers.appendValue(helper, "_relation", _relation); + CodeHelpers.appendValue(helper, "_terminateConfigPrimitive", _terminateConfigPrimitive); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/extended/vnf/configuration/Day12Key.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/extended/vnf/configuration/Day12Key.java new file mode 100644 index 0000000000000000000000000000000000000000..777c44eb1b637ade196dbcb3710a25d4bce3d0a3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/day1/_2/norev/extended/vnf/configuration/Day12Key.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.day1._2.norev.extended.vnf.configuration; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class Day12Key + implements Identifier { + private static final long serialVersionUID = 927482176980315623L; + private final String _id; + + + public Day12Key(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public Day12Key(Day12Key source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof Day12Key)) { + return false; + } + final Day12Key other = (Day12Key) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(Day12Key.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..cd070c7c6c9ce831d14d2fef76d703a463db85b4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4ac719b2c0cb3c0c250694aafa9d292f7bb7bac4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/$YangModuleInfoImpl.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:osm:yang:augments:epa", "epa").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/epa.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/AllocationProperties.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/AllocationProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..fb1d48e75b7cb2bbacf24615ccaee37e82b4aeec --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/AllocationProperties.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * grouping allocation-properties {
+ *   leaf limit {
+ *     type uint64;
+ *   }
+ *   leaf reserve {
+ *     type uint64;
+ *   }
+ *   leaf shares {
+ *     type uint64;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/allocation-properties + * + */ +public interface AllocationProperties + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("allocation-properties"); + + @Override + Class implementedInterface(); + + /** + * Defines the maximum allocation. The value 0 indicates that usage is not limited. + * This parameter ensures that the instance never uses more than the defined amount + * of resource. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 limit, or null if not present + */ + @Nullable Uint64 getLimit(); + + /** + * Defines the guaranteed minimum reservation. If needed, the machine will + * definitely get allocated the reserved amount of resources. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 reserve, or null if not present + */ + @Nullable Uint64 getReserve(); + + /** + * Number of shares allocated. Specifies the proportional weighted share for the + * domain. If this element is omitted, the service defaults to the OS provided + * defaults + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 shares, or null if not present + */ + @Nullable Uint64 getShares(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedCpuPolicy.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedCpuPolicy.java new file mode 100644 index 0000000000000000000000000000000000000000..3699d34bc67aefa59a6a5b055dddd4db7feb6e83 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedCpuPolicy.java @@ -0,0 +1,127 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * grouping extended-cpu-policy {
+ *   leaf thread-policy {
+ *     type enumeration {
+ *       enum AVOID;
+ *       enum SEPARATE;
+ *       enum ISOLATE;
+ *       enum PREFER;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-cpu-policy + * + */ +public interface ExtendedCpuPolicy + extends + DataObject +{ + + + public enum ThreadPolicy implements Enumeration { + AVOID(0, "AVOID"), + + SEPARATE(1, "SEPARATE"), + + ISOLATE(2, "ISOLATE"), + + PREFER(3, "PREFER") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (ThreadPolicy enumItem : ThreadPolicy.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private ThreadPolicy(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding ThreadPolicy item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding ThreadPolicy item, or null if no such item exists + */ + public static ThreadPolicy forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-cpu-policy"); + + @Override + Class implementedInterface(); + + /** + * CPU thread pinning policy describes how to place the guest CPUs when the host + * supports hyper threads: AVOID : Avoids placing a guest on a host with threads. + * SEPARATE: Places vCPUs on separate cores, and avoids placing two vCPUs on two + * threads of same core. ISOLATE : Places each vCPU on a different core, and places + * no vCPUs from a different guest on the same core. PREFER : Attempts to place + * vCPUs on threads of the same core. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuPolicy.ThreadPolicy threadPolicy, or null if not present + */ + @Nullable ThreadPolicy getThreadPolicy(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedCpuQuota.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedCpuQuota.java new file mode 100644 index 0000000000000000000000000000000000000000..81957772b586a6459cbf8689682d967f463cb6f9 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedCpuQuota.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.cpu.quota.CpuQuota; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * grouping extended-cpu-quota {
+ *   container cpu-quota {
+ *     uses allocation-properties;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-cpu-quota + * + */ +public interface ExtendedCpuQuota + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-cpu-quota"); + + @Override + Class implementedInterface(); + + /** + * CPU quota describes the CPU resource allocation policy. Limit and Reserve values + * are defined in MHz + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.cpu.quota.CpuQuota cpuQuota, or null if not present + */ + @Nullable CpuQuota getCpuQuota(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedDiskIoQuota.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedDiskIoQuota.java new file mode 100644 index 0000000000000000000000000000000000000000..8921e40d91f9e5561161d852a8cda25a4109147a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedDiskIoQuota.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.disk.io.quota.DiskIoQuota; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * grouping extended-disk-io-quota {
+ *   container disk-io-quota {
+ *     uses allocation-properties;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-disk-io-quota + * + */ +public interface ExtendedDiskIoQuota + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-disk-io-quota"); + + @Override + Class implementedInterface(); + + /** + * Disk IO quota describes the disk IO operations resource allocation policy. Limit + * and Reserve values are defined in IOPS + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.disk.io.quota.DiskIoQuota diskIoQuota, or null if not present + */ + @Nullable DiskIoQuota getDiskIoQuota(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedMemQuota.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedMemQuota.java new file mode 100644 index 0000000000000000000000000000000000000000..f7d39a7d4e9ad6a6702e27420c5c91327c9ebf7b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedMemQuota.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.mem.quota.MemQuota; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * grouping extended-mem-quota {
+ *   container mem-quota {
+ *     uses allocation-properties;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-mem-quota + * + */ +public interface ExtendedMemQuota + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-mem-quota"); + + @Override + Class implementedInterface(); + + /** + * Memory quota describes the memory resource allocation policy. Limit and Reserve + * values are defined in MB + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.mem.quota.MemQuota memQuota, or null if not present + */ + @Nullable MemQuota getMemQuota(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedMempageSize.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedMempageSize.java new file mode 100644 index 0000000000000000000000000000000000000000..56a01e9953e23c15d87ea62030351c5ad03ab49a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedMempageSize.java @@ -0,0 +1,129 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * grouping extended-mempage-size {
+ *   leaf mempage-size {
+ *     type enumeration {
+ *       enum LARGE;
+ *       enum SMALL;
+ *       enum SIZE_2MB;
+ *       enum SIZE_1GB;
+ *       enum PREFER_LARGE;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-mempage-size + * + */ +public interface ExtendedMempageSize + extends + DataObject +{ + + + public enum MempageSize implements Enumeration { + LARGE(0, "LARGE"), + + SMALL(1, "SMALL"), + + SIZE2MB(2, "SIZE_2MB"), + + SIZE1GB(3, "SIZE_1GB"), + + PREFERLARGE(4, "PREFER_LARGE") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (MempageSize enumItem : MempageSize.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private MempageSize(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding MempageSize item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding MempageSize item, or null if no such item exists + */ + public static MempageSize forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-mempage-size"); + + @Override + Class implementedInterface(); + + /** + * Memory page allocation size. If a VM requires hugepages, it should choose LARGE + * or SIZE_2MB or SIZE_1GB. If the VM prefers hugepages it should choose + * PREFER_LARGE. LARGE : Require hugepages (either 2MB or 1GB) SMALL : Doesn't + * require hugepages SIZE_2MB : Requires 2MB hugepages SIZE_1GB : Requires 1GB + * hugepages PREFER_LARGE : Application prefers hugepages + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMempageSize.MempageSize mempageSize, or null if not present + */ + @Nullable MempageSize getMempageSize(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedNuma.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedNuma.java new file mode 100644 index 0000000000000000000000000000000000000000..f727276bbb30d2dd519d97bcac2e6546ef4b952b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedNuma.java @@ -0,0 +1,103 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.NumaNodePolicy; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * grouping extended-numa {
+ *   container numa-node-policy {
+ *     leaf node-cnt {
+ *       type uint16;
+ *     }
+ *     leaf mem-policy {
+ *       type enumeration {
+ *         enum STRICT;
+ *         enum PREFERRED;
+ *       }
+ *     }
+ *     list node {
+ *       key id;
+ *       leaf id {
+ *         type uint64;
+ *       }
+ *       list vcpu {
+ *         key id;
+ *         leaf id {
+ *           type uint64;
+ *         }
+ *       }
+ *       leaf memory-mb {
+ *         type uint64;
+ *       }
+ *       choice om-numa-type {
+ *         case cores {
+ *           leaf num-cores {
+ *             type uint8;
+ *           }
+ *         }
+ *         case paired-threads {
+ *           container paired-threads {
+ *             leaf num-paired-threads {
+ *               type uint8;
+ *             }
+ *             list paired-thread-ids {
+ *               max-elements 16;
+ *               key thread-a;
+ *               leaf thread-a {
+ *                 type uint8;
+ *               }
+ *               leaf thread-b {
+ *                 type uint8;
+ *               }
+ *             }
+ *           }
+ *         }
+ *         case threads {
+ *           leaf num-threads {
+ *             type uint8;
+ *           }
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-numa + * + */ +public interface ExtendedNuma + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-numa"); + + @Override + Class implementedInterface(); + + /** + * This policy defines NUMA topology of the guest. Specifically identifies if the + * guest should be run on a host with one NUMA node or multiple NUMA nodes. As an + * example a guest might need 8 VCPUs and 4 GB of memory. However, it might need + * the VCPUs and memory distributed across multiple NUMA nodes. In this scenario, + * NUMA node 1 could run with 6 VCPUs and 3GB, and NUMA node 2 could run with 2 + * VCPUs and 1GB. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.NumaNodePolicy numaNodePolicy, or null if not present + */ + @Nullable NumaNodePolicy getNumaNodePolicy(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedVifQuota.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedVifQuota.java new file mode 100644 index 0000000000000000000000000000000000000000..dff272473ec5b404c883ebbd340aba3254209974 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/ExtendedVifQuota.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.vif.quota.VifQuota; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * grouping extended-vif-quota {
+ *   container vif-quota {
+ *     uses allocation-properties;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-vif-quota + * + */ +public interface ExtendedVifQuota + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-vif-quota"); + + @Override + Class implementedInterface(); + + /** + * Virtual interfaces quota describes the virtual interface bandwidth resource + * allocation policy. Limit and Reserve values are defined in Mbps + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.vif.quota.VifQuota vifQuota, or null if not present + */ + @Nullable VifQuota getVifQuota(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/Pinning1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/Pinning1.java new file mode 100644 index 0000000000000000000000000000000000000000..0f574da028d6e416e32aa6b6b425be90d6a0218c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/Pinning1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.virtual.cpu.Pinning; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface Pinning1 + extends + Augmentation, + ExtendedCpuPolicy +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.Pinning1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/Pinning1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/Pinning1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..75fe7e5fe63cd5370313b118ef722801a50f5d32 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/Pinning1Builder.java @@ -0,0 +1,157 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link Pinning1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     Pinning1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new Pinning1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of Pinning1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see Pinning1Builder + * @see Builder + * + */ +public class Pinning1Builder implements Builder { + + private ExtendedCpuPolicy.ThreadPolicy _threadPolicy; + + + + public Pinning1Builder() { + } + public Pinning1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuPolicy arg) { + this._threadPolicy = arg.getThreadPolicy(); + } + + public Pinning1Builder(Pinning1 base) { + this._threadPolicy = base.getThreadPolicy(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuPolicy
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuPolicy) { + this._threadPolicy = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuPolicy)arg).getThreadPolicy(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuPolicy]"); + } + + public ExtendedCpuPolicy.ThreadPolicy getThreadPolicy() { + return _threadPolicy; + } + + + public Pinning1Builder setThreadPolicy(final ExtendedCpuPolicy.ThreadPolicy value) { + this._threadPolicy = value; + return this; + } + + + @Override + public Pinning1 build() { + return new Pinning1Impl(this); + } + + private static final class Pinning1Impl + implements Pinning1 { + + private final ExtendedCpuPolicy.ThreadPolicy _threadPolicy; + + Pinning1Impl(Pinning1Builder base) { + this._threadPolicy = base.getThreadPolicy(); + } + + @Override + public ExtendedCpuPolicy.ThreadPolicy getThreadPolicy() { + return _threadPolicy; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_threadPolicy); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Pinning1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Pinning1 other = (Pinning1)obj; + if (!Objects.equals(_threadPolicy, other.getThreadPolicy())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Pinning1"); + CodeHelpers.appendValue(helper, "_threadPolicy", _threadPolicy); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualCpu1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualCpu1.java new file mode 100644 index 0000000000000000000000000000000000000000..3578e170305c27cca1dc1014c8ab0601664c9bf1 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualCpu1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualCpu; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface VirtualCpu1 + extends + Augmentation, + ExtendedCpuQuota +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.VirtualCpu1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualCpu1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualCpu1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..50a6ee4711d828054b9eeddaf918c59bcad02327 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualCpu1Builder.java @@ -0,0 +1,158 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.cpu.quota.CpuQuota; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualCpu1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualCpu1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualCpu1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualCpu1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualCpu1Builder + * @see Builder + * + */ +public class VirtualCpu1Builder implements Builder { + + private CpuQuota _cpuQuota; + + + + public VirtualCpu1Builder() { + } + public VirtualCpu1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuQuota arg) { + this._cpuQuota = arg.getCpuQuota(); + } + + public VirtualCpu1Builder(VirtualCpu1 base) { + this._cpuQuota = base.getCpuQuota(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuQuota
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuQuota) { + this._cpuQuota = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuQuota)arg).getCpuQuota(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuQuota]"); + } + + public CpuQuota getCpuQuota() { + return _cpuQuota; + } + + + public VirtualCpu1Builder setCpuQuota(final CpuQuota value) { + this._cpuQuota = value; + return this; + } + + + @Override + public VirtualCpu1 build() { + return new VirtualCpu1Impl(this); + } + + private static final class VirtualCpu1Impl + implements VirtualCpu1 { + + private final CpuQuota _cpuQuota; + + VirtualCpu1Impl(VirtualCpu1Builder base) { + this._cpuQuota = base.getCpuQuota(); + } + + @Override + public CpuQuota getCpuQuota() { + return _cpuQuota; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cpuQuota); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualCpu1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualCpu1 other = (VirtualCpu1)obj; + if (!Objects.equals(_cpuQuota, other.getCpuQuota())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualCpu1"); + CodeHelpers.appendValue(helper, "_cpuQuota", _cpuQuota); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualMemory1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualMemory1.java new file mode 100644 index 0000000000000000000000000000000000000000..175e83c5827331ff7e5c9c1e1cca997c0b3e46e9 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualMemory1.java @@ -0,0 +1,24 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.virtual.compute.desc.VirtualMemory; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface VirtualMemory1 + extends + Augmentation, + ExtendedNuma, + ExtendedMempageSize, + ExtendedMemQuota +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.VirtualMemory1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualMemory1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualMemory1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..0104cc63262e9a06c48bdd4950c5f38b342a7b02 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualMemory1Builder.java @@ -0,0 +1,221 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.mem.quota.MemQuota; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.NumaNodePolicy; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualMemory1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualMemory1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualMemory1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualMemory1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualMemory1Builder + * @see Builder + * + */ +public class VirtualMemory1Builder implements Builder { + + private MemQuota _memQuota; + private ExtendedMempageSize.MempageSize _mempageSize; + private NumaNodePolicy _numaNodePolicy; + + + + public VirtualMemory1Builder() { + } + public VirtualMemory1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedNuma arg) { + this._numaNodePolicy = arg.getNumaNodePolicy(); + } + public VirtualMemory1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMempageSize arg) { + this._mempageSize = arg.getMempageSize(); + } + public VirtualMemory1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMemQuota arg) { + this._memQuota = arg.getMemQuota(); + } + + public VirtualMemory1Builder(VirtualMemory1 base) { + this._memQuota = base.getMemQuota(); + this._mempageSize = base.getMempageSize(); + this._numaNodePolicy = base.getNumaNodePolicy(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedNuma
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMempageSize
  • + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMemQuota
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedNuma) { + this._numaNodePolicy = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedNuma)arg).getNumaNodePolicy(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMempageSize) { + this._mempageSize = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMempageSize)arg).getMempageSize(); + isValidArg = true; + } + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMemQuota) { + this._memQuota = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMemQuota)arg).getMemQuota(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedNuma, org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMempageSize, org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMemQuota]"); + } + + public MemQuota getMemQuota() { + return _memQuota; + } + + public ExtendedMempageSize.MempageSize getMempageSize() { + return _mempageSize; + } + + public NumaNodePolicy getNumaNodePolicy() { + return _numaNodePolicy; + } + + + public VirtualMemory1Builder setMemQuota(final MemQuota value) { + this._memQuota = value; + return this; + } + + public VirtualMemory1Builder setMempageSize(final ExtendedMempageSize.MempageSize value) { + this._mempageSize = value; + return this; + } + + public VirtualMemory1Builder setNumaNodePolicy(final NumaNodePolicy value) { + this._numaNodePolicy = value; + return this; + } + + + @Override + public VirtualMemory1 build() { + return new VirtualMemory1Impl(this); + } + + private static final class VirtualMemory1Impl + implements VirtualMemory1 { + + private final MemQuota _memQuota; + private final ExtendedMempageSize.MempageSize _mempageSize; + private final NumaNodePolicy _numaNodePolicy; + + VirtualMemory1Impl(VirtualMemory1Builder base) { + this._memQuota = base.getMemQuota(); + this._mempageSize = base.getMempageSize(); + this._numaNodePolicy = base.getNumaNodePolicy(); + } + + @Override + public MemQuota getMemQuota() { + return _memQuota; + } + + @Override + public ExtendedMempageSize.MempageSize getMempageSize() { + return _mempageSize; + } + + @Override + public NumaNodePolicy getNumaNodePolicy() { + return _numaNodePolicy; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_memQuota); + result = prime * result + Objects.hashCode(_mempageSize); + result = prime * result + Objects.hashCode(_numaNodePolicy); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualMemory1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualMemory1 other = (VirtualMemory1)obj; + if (!Objects.equals(_memQuota, other.getMemQuota())) { + return false; + } + if (!Objects.equals(_mempageSize, other.getMempageSize())) { + return false; + } + if (!Objects.equals(_numaNodePolicy, other.getNumaNodePolicy())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualMemory1"); + CodeHelpers.appendValue(helper, "_memQuota", _memQuota); + CodeHelpers.appendValue(helper, "_mempageSize", _mempageSize); + CodeHelpers.appendValue(helper, "_numaNodePolicy", _numaNodePolicy); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualNetworkInterfaceRequirement1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualNetworkInterfaceRequirement1.java new file mode 100644 index 0000000000000000000000000000000000000000..6095aedc9ff9f013532337e2961fa638a0af106e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualNetworkInterfaceRequirement1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.virtual.network._interface.requirements.VirtualNetworkInterfaceRequirement; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface VirtualNetworkInterfaceRequirement1 + extends + Augmentation, + ExtendedVifQuota +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.VirtualNetworkInterfaceRequirement1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualNetworkInterfaceRequirement1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualNetworkInterfaceRequirement1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..4bf35afd81d6bbe168555d9db4e5771419a5c3ab --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualNetworkInterfaceRequirement1Builder.java @@ -0,0 +1,158 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.vif.quota.VifQuota; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualNetworkInterfaceRequirement1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualNetworkInterfaceRequirement1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualNetworkInterfaceRequirement1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualNetworkInterfaceRequirement1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualNetworkInterfaceRequirement1Builder + * @see Builder + * + */ +public class VirtualNetworkInterfaceRequirement1Builder implements Builder { + + private VifQuota _vifQuota; + + + + public VirtualNetworkInterfaceRequirement1Builder() { + } + public VirtualNetworkInterfaceRequirement1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedVifQuota arg) { + this._vifQuota = arg.getVifQuota(); + } + + public VirtualNetworkInterfaceRequirement1Builder(VirtualNetworkInterfaceRequirement1 base) { + this._vifQuota = base.getVifQuota(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedVifQuota
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedVifQuota) { + this._vifQuota = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedVifQuota)arg).getVifQuota(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedVifQuota]"); + } + + public VifQuota getVifQuota() { + return _vifQuota; + } + + + public VirtualNetworkInterfaceRequirement1Builder setVifQuota(final VifQuota value) { + this._vifQuota = value; + return this; + } + + + @Override + public VirtualNetworkInterfaceRequirement1 build() { + return new VirtualNetworkInterfaceRequirement1Impl(this); + } + + private static final class VirtualNetworkInterfaceRequirement1Impl + implements VirtualNetworkInterfaceRequirement1 { + + private final VifQuota _vifQuota; + + VirtualNetworkInterfaceRequirement1Impl(VirtualNetworkInterfaceRequirement1Builder base) { + this._vifQuota = base.getVifQuota(); + } + + @Override + public VifQuota getVifQuota() { + return _vifQuota; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_vifQuota); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualNetworkInterfaceRequirement1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualNetworkInterfaceRequirement1 other = (VirtualNetworkInterfaceRequirement1)obj; + if (!Objects.equals(_vifQuota, other.getVifQuota())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualNetworkInterfaceRequirement1"); + CodeHelpers.appendValue(helper, "_vifQuota", _vifQuota); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualStorageDesc1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualStorageDesc1.java new file mode 100644 index 0000000000000000000000000000000000000000..fbb098a9352f84ccea96c7b03a8c62f0a8b5b8d7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualStorageDesc1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.vnfd.VirtualStorageDesc; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface VirtualStorageDesc1 + extends + Augmentation, + ExtendedDiskIoQuota +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.VirtualStorageDesc1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualStorageDesc1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualStorageDesc1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..52faa544657663129bc6ad0c48a63c9b25e68b43 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/VirtualStorageDesc1Builder.java @@ -0,0 +1,158 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.disk.io.quota.DiskIoQuota; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualStorageDesc1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualStorageDesc1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualStorageDesc1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualStorageDesc1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualStorageDesc1Builder + * @see Builder + * + */ +public class VirtualStorageDesc1Builder implements Builder { + + private DiskIoQuota _diskIoQuota; + + + + public VirtualStorageDesc1Builder() { + } + public VirtualStorageDesc1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedDiskIoQuota arg) { + this._diskIoQuota = arg.getDiskIoQuota(); + } + + public VirtualStorageDesc1Builder(VirtualStorageDesc1 base) { + this._diskIoQuota = base.getDiskIoQuota(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedDiskIoQuota
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedDiskIoQuota) { + this._diskIoQuota = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedDiskIoQuota)arg).getDiskIoQuota(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedDiskIoQuota]"); + } + + public DiskIoQuota getDiskIoQuota() { + return _diskIoQuota; + } + + + public VirtualStorageDesc1Builder setDiskIoQuota(final DiskIoQuota value) { + this._diskIoQuota = value; + return this; + } + + + @Override + public VirtualStorageDesc1 build() { + return new VirtualStorageDesc1Impl(this); + } + + private static final class VirtualStorageDesc1Impl + implements VirtualStorageDesc1 { + + private final DiskIoQuota _diskIoQuota; + + VirtualStorageDesc1Impl(VirtualStorageDesc1Builder base) { + this._diskIoQuota = base.getDiskIoQuota(); + } + + @Override + public DiskIoQuota getDiskIoQuota() { + return _diskIoQuota; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_diskIoQuota); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualStorageDesc1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualStorageDesc1 other = (VirtualStorageDesc1)obj; + if (!Objects.equals(_diskIoQuota, other.getDiskIoQuota())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualStorageDesc1"); + CodeHelpers.appendValue(helper, "_diskIoQuota", _diskIoQuota); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/cpu/quota/CpuQuota.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/cpu/quota/CpuQuota.java new file mode 100644 index 0000000000000000000000000000000000000000..dcf91eeaddf9493b4ae5faf5c0f5677f312df613 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/cpu/quota/CpuQuota.java @@ -0,0 +1,46 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.cpu.quota; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedCpuQuota; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * CPU quota describes the CPU resource allocation policy. Limit and Reserve + * are defined in MHz + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * container cpu-quota {
+ *   uses allocation-properties;
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-cpu-quota/cpu-quota + * + *

To create instances of this class use {@link CpuQuotaBuilder}. + * @see CpuQuotaBuilder + * + */ +public interface CpuQuota + extends + ChildOf, + Augmentable, + AllocationProperties +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("cpu-quota"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.cpu.quota.CpuQuota.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/cpu/quota/CpuQuotaBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/cpu/quota/CpuQuotaBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..82f15fda58ab9058af0f67655e72efc6ce37b673 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/cpu/quota/CpuQuotaBuilder.java @@ -0,0 +1,335 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.cpu.quota; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link CpuQuotaBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     CpuQuotaBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new CpuQuotaBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of CpuQuotaBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see CpuQuotaBuilder + * @see Builder + * + */ +public class CpuQuotaBuilder implements Builder { + + private Uint64 _limit; + private Uint64 _reserve; + private Uint64 _shares; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public CpuQuotaBuilder() { + } + public CpuQuotaBuilder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties arg) { + this._limit = arg.getLimit(); + this._reserve = arg.getReserve(); + this._shares = arg.getShares(); + } + + public CpuQuotaBuilder(CpuQuota base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._limit = base.getLimit(); + this._reserve = base.getReserve(); + this._shares = base.getShares(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties) { + this._limit = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getLimit(); + this._reserve = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getReserve(); + this._shares = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getShares(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties]"); + } + + public Uint64 getLimit() { + return _limit; + } + + public Uint64 getReserve() { + return _reserve; + } + + public Uint64 getShares() { + return _shares; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public CpuQuotaBuilder setLimit(final Uint64 value) { + this._limit = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLimit(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public CpuQuotaBuilder setLimit(final BigInteger value) { + return setLimit(CodeHelpers.compatUint(value)); + } + + public CpuQuotaBuilder setReserve(final Uint64 value) { + this._reserve = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setReserve(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public CpuQuotaBuilder setReserve(final BigInteger value) { + return setReserve(CodeHelpers.compatUint(value)); + } + + public CpuQuotaBuilder setShares(final Uint64 value) { + this._shares = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setShares(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public CpuQuotaBuilder setShares(final BigInteger value) { + return setShares(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public CpuQuotaBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public CpuQuotaBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public CpuQuotaBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private CpuQuotaBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public CpuQuota build() { + return new CpuQuotaImpl(this); + } + + private static final class CpuQuotaImpl + extends AbstractAugmentable + implements CpuQuota { + + private final Uint64 _limit; + private final Uint64 _reserve; + private final Uint64 _shares; + + CpuQuotaImpl(CpuQuotaBuilder base) { + super(base.augmentation); + this._limit = base.getLimit(); + this._reserve = base.getReserve(); + this._shares = base.getShares(); + } + + @Override + public Uint64 getLimit() { + return _limit; + } + + @Override + public Uint64 getReserve() { + return _reserve; + } + + @Override + public Uint64 getShares() { + return _shares; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_limit); + result = prime * result + Objects.hashCode(_reserve); + result = prime * result + Objects.hashCode(_shares); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!CpuQuota.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + CpuQuota other = (CpuQuota)obj; + if (!Objects.equals(_limit, other.getLimit())) { + return false; + } + if (!Objects.equals(_reserve, other.getReserve())) { + return false; + } + if (!Objects.equals(_shares, other.getShares())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + CpuQuotaImpl otherImpl = (CpuQuotaImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("CpuQuota"); + CodeHelpers.appendValue(helper, "_limit", _limit); + CodeHelpers.appendValue(helper, "_reserve", _reserve); + CodeHelpers.appendValue(helper, "_shares", _shares); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/disk/io/quota/DiskIoQuota.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/disk/io/quota/DiskIoQuota.java new file mode 100644 index 0000000000000000000000000000000000000000..835fbce9f2293a2d99f8eda403595d5751b8861b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/disk/io/quota/DiskIoQuota.java @@ -0,0 +1,46 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.disk.io.quota; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedDiskIoQuota; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Disk IO quota describes the disk IO operations resource allocation policy. + * and Reserve values are defined in IOPS + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * container disk-io-quota {
+ *   uses allocation-properties;
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-disk-io-quota/disk-io-quota + * + *

To create instances of this class use {@link DiskIoQuotaBuilder}. + * @see DiskIoQuotaBuilder + * + */ +public interface DiskIoQuota + extends + ChildOf, + Augmentable, + AllocationProperties +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("disk-io-quota"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.disk.io.quota.DiskIoQuota.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/disk/io/quota/DiskIoQuotaBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/disk/io/quota/DiskIoQuotaBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..1de3b587d0bb6ec2c2ce110373c07dd2031d2c78 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/disk/io/quota/DiskIoQuotaBuilder.java @@ -0,0 +1,335 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.disk.io.quota; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link DiskIoQuotaBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     DiskIoQuotaBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new DiskIoQuotaBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of DiskIoQuotaBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see DiskIoQuotaBuilder + * @see Builder + * + */ +public class DiskIoQuotaBuilder implements Builder { + + private Uint64 _limit; + private Uint64 _reserve; + private Uint64 _shares; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public DiskIoQuotaBuilder() { + } + public DiskIoQuotaBuilder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties arg) { + this._limit = arg.getLimit(); + this._reserve = arg.getReserve(); + this._shares = arg.getShares(); + } + + public DiskIoQuotaBuilder(DiskIoQuota base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._limit = base.getLimit(); + this._reserve = base.getReserve(); + this._shares = base.getShares(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties) { + this._limit = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getLimit(); + this._reserve = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getReserve(); + this._shares = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getShares(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties]"); + } + + public Uint64 getLimit() { + return _limit; + } + + public Uint64 getReserve() { + return _reserve; + } + + public Uint64 getShares() { + return _shares; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public DiskIoQuotaBuilder setLimit(final Uint64 value) { + this._limit = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLimit(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public DiskIoQuotaBuilder setLimit(final BigInteger value) { + return setLimit(CodeHelpers.compatUint(value)); + } + + public DiskIoQuotaBuilder setReserve(final Uint64 value) { + this._reserve = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setReserve(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public DiskIoQuotaBuilder setReserve(final BigInteger value) { + return setReserve(CodeHelpers.compatUint(value)); + } + + public DiskIoQuotaBuilder setShares(final Uint64 value) { + this._shares = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setShares(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public DiskIoQuotaBuilder setShares(final BigInteger value) { + return setShares(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public DiskIoQuotaBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public DiskIoQuotaBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public DiskIoQuotaBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private DiskIoQuotaBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public DiskIoQuota build() { + return new DiskIoQuotaImpl(this); + } + + private static final class DiskIoQuotaImpl + extends AbstractAugmentable + implements DiskIoQuota { + + private final Uint64 _limit; + private final Uint64 _reserve; + private final Uint64 _shares; + + DiskIoQuotaImpl(DiskIoQuotaBuilder base) { + super(base.augmentation); + this._limit = base.getLimit(); + this._reserve = base.getReserve(); + this._shares = base.getShares(); + } + + @Override + public Uint64 getLimit() { + return _limit; + } + + @Override + public Uint64 getReserve() { + return _reserve; + } + + @Override + public Uint64 getShares() { + return _shares; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_limit); + result = prime * result + Objects.hashCode(_reserve); + result = prime * result + Objects.hashCode(_shares); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!DiskIoQuota.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + DiskIoQuota other = (DiskIoQuota)obj; + if (!Objects.equals(_limit, other.getLimit())) { + return false; + } + if (!Objects.equals(_reserve, other.getReserve())) { + return false; + } + if (!Objects.equals(_shares, other.getShares())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + DiskIoQuotaImpl otherImpl = (DiskIoQuotaImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("DiskIoQuota"); + CodeHelpers.appendValue(helper, "_limit", _limit); + CodeHelpers.appendValue(helper, "_reserve", _reserve); + CodeHelpers.appendValue(helper, "_shares", _shares); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/mem/quota/MemQuota.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/mem/quota/MemQuota.java new file mode 100644 index 0000000000000000000000000000000000000000..81b16fba9f96362cc182a353e94f8bdcb054cc48 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/mem/quota/MemQuota.java @@ -0,0 +1,46 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.mem.quota; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedMemQuota; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Memory quota describes the memory resource allocation policy. Limit and Reserve + * values are defined in MB + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * container mem-quota {
+ *   uses allocation-properties;
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-mem-quota/mem-quota + * + *

To create instances of this class use {@link MemQuotaBuilder}. + * @see MemQuotaBuilder + * + */ +public interface MemQuota + extends + ChildOf, + Augmentable, + AllocationProperties +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("mem-quota"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.mem.quota.MemQuota.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/mem/quota/MemQuotaBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/mem/quota/MemQuotaBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..950e5a2cc474297c2ebb0bd2f75604e49b0281f4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/mem/quota/MemQuotaBuilder.java @@ -0,0 +1,335 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.mem.quota; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link MemQuotaBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     MemQuotaBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new MemQuotaBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of MemQuotaBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see MemQuotaBuilder + * @see Builder + * + */ +public class MemQuotaBuilder implements Builder { + + private Uint64 _limit; + private Uint64 _reserve; + private Uint64 _shares; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public MemQuotaBuilder() { + } + public MemQuotaBuilder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties arg) { + this._limit = arg.getLimit(); + this._reserve = arg.getReserve(); + this._shares = arg.getShares(); + } + + public MemQuotaBuilder(MemQuota base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._limit = base.getLimit(); + this._reserve = base.getReserve(); + this._shares = base.getShares(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties) { + this._limit = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getLimit(); + this._reserve = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getReserve(); + this._shares = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getShares(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties]"); + } + + public Uint64 getLimit() { + return _limit; + } + + public Uint64 getReserve() { + return _reserve; + } + + public Uint64 getShares() { + return _shares; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public MemQuotaBuilder setLimit(final Uint64 value) { + this._limit = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLimit(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public MemQuotaBuilder setLimit(final BigInteger value) { + return setLimit(CodeHelpers.compatUint(value)); + } + + public MemQuotaBuilder setReserve(final Uint64 value) { + this._reserve = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setReserve(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public MemQuotaBuilder setReserve(final BigInteger value) { + return setReserve(CodeHelpers.compatUint(value)); + } + + public MemQuotaBuilder setShares(final Uint64 value) { + this._shares = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setShares(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public MemQuotaBuilder setShares(final BigInteger value) { + return setShares(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public MemQuotaBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public MemQuotaBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public MemQuotaBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private MemQuotaBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public MemQuota build() { + return new MemQuotaImpl(this); + } + + private static final class MemQuotaImpl + extends AbstractAugmentable + implements MemQuota { + + private final Uint64 _limit; + private final Uint64 _reserve; + private final Uint64 _shares; + + MemQuotaImpl(MemQuotaBuilder base) { + super(base.augmentation); + this._limit = base.getLimit(); + this._reserve = base.getReserve(); + this._shares = base.getShares(); + } + + @Override + public Uint64 getLimit() { + return _limit; + } + + @Override + public Uint64 getReserve() { + return _reserve; + } + + @Override + public Uint64 getShares() { + return _shares; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_limit); + result = prime * result + Objects.hashCode(_reserve); + result = prime * result + Objects.hashCode(_shares); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!MemQuota.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + MemQuota other = (MemQuota)obj; + if (!Objects.equals(_limit, other.getLimit())) { + return false; + } + if (!Objects.equals(_reserve, other.getReserve())) { + return false; + } + if (!Objects.equals(_shares, other.getShares())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + MemQuotaImpl otherImpl = (MemQuotaImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("MemQuota"); + CodeHelpers.appendValue(helper, "_limit", _limit); + CodeHelpers.appendValue(helper, "_reserve", _reserve); + CodeHelpers.appendValue(helper, "_shares", _shares); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/NumaNodePolicy.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/NumaNodePolicy.java new file mode 100644 index 0000000000000000000000000000000000000000..1d21ab79ab559d31ed4ee724ecac55289b1435be --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/NumaNodePolicy.java @@ -0,0 +1,206 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedNuma; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.Node; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.NodeKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * This policy defines NUMA topology of the guest. Specifically identifies if the + * guest should be run on a host with one NUMA node or multiple NUMA nodes. As an + * example a guest might need 8 VCPUs and 4 GB of memory. However, it might need + * the VCPUs and memory distributed across multiple NUMA nodes. In this scenario, + * NUMA node 1 could run with 6 VCPUs and 3GB, and NUMA node 2 could run with 2 + * VCPUs and 1GB. + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * container numa-node-policy {
+ *   leaf node-cnt {
+ *     type uint16;
+ *   }
+ *   leaf mem-policy {
+ *     type enumeration {
+ *       enum STRICT;
+ *       enum PREFERRED;
+ *     }
+ *   }
+ *   list node {
+ *     key id;
+ *     leaf id {
+ *       type uint64;
+ *     }
+ *     list vcpu {
+ *       key id;
+ *       leaf id {
+ *         type uint64;
+ *       }
+ *     }
+ *     leaf memory-mb {
+ *       type uint64;
+ *     }
+ *     choice om-numa-type {
+ *       case cores {
+ *         leaf num-cores {
+ *           type uint8;
+ *         }
+ *       }
+ *       case paired-threads {
+ *         container paired-threads {
+ *           leaf num-paired-threads {
+ *             type uint8;
+ *           }
+ *           list paired-thread-ids {
+ *             max-elements 16;
+ *             key thread-a;
+ *             leaf thread-a {
+ *               type uint8;
+ *             }
+ *             leaf thread-b {
+ *               type uint8;
+ *             }
+ *           }
+ *         }
+ *       }
+ *       case threads {
+ *         leaf num-threads {
+ *           type uint8;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-numa/numa-node-policy + * + *

To create instances of this class use {@link NumaNodePolicyBuilder}. + * @see NumaNodePolicyBuilder + * + */ +public interface NumaNodePolicy + extends + ChildOf, + Augmentable +{ + + + public enum MemPolicy implements Enumeration { + STRICT(0, "STRICT"), + + PREFERRED(1, "PREFERRED") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (MemPolicy enumItem : MemPolicy.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private MemPolicy(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding MemPolicy item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding MemPolicy item, or null if no such item exists + */ + public static MemPolicy forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("numa-node-policy"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.NumaNodePolicy.class; + } + + /** + * The number of NUMA nodes to expose to the VM. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 nodeCnt, or null if not present + */ + @Nullable Uint16 getNodeCnt(); + + /** + * This policy specifies how the memory should be allocated in a multi-node + * scenario. STRICT : The memory must be allocated strictly from the memory + * attached to the NUMA node. PREFERRED : The memory should be allocated + * preferentially from the memory attached to the NUMA node + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.NumaNodePolicy.MemPolicy memPolicy, or null if not present + */ + @Nullable MemPolicy getMemPolicy(); + + /** + * @return java.util.Map node, or null if not present + */ + @Nullable Map getNode(); + + /** + * @return java.util.Map node, or an empty list if it is not present + */ + default @NonNull Map nonnullNode() { + return CodeHelpers.nonnull(getNode()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/NumaNodePolicyBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/NumaNodePolicyBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..17450580d9ee3721310d7b1ab818d3c98899feb8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/NumaNodePolicyBuilder.java @@ -0,0 +1,307 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Integer; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.Node; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.NodeKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Class that builds {@link NumaNodePolicyBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NumaNodePolicyBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NumaNodePolicyBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NumaNodePolicyBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NumaNodePolicyBuilder + * @see Builder + * + */ +public class NumaNodePolicyBuilder implements Builder { + + private NumaNodePolicy.MemPolicy _memPolicy; + private Map _node; + private Uint16 _nodeCnt; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NumaNodePolicyBuilder() { + } + + public NumaNodePolicyBuilder(NumaNodePolicy base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._memPolicy = base.getMemPolicy(); + this._node = base.getNode(); + this._nodeCnt = base.getNodeCnt(); + } + + + public NumaNodePolicy.MemPolicy getMemPolicy() { + return _memPolicy; + } + + public Map getNode() { + return _node; + } + + public Uint16 getNodeCnt() { + return _nodeCnt; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public NumaNodePolicyBuilder setMemPolicy(final NumaNodePolicy.MemPolicy value) { + this._memPolicy = value; + return this; + } + public NumaNodePolicyBuilder setNode(final Map values) { + this._node = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setNode(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NumaNodePolicyBuilder setNode(final List values) { + return setNode(CodeHelpers.compatMap(values)); + } + + public NumaNodePolicyBuilder setNodeCnt(final Uint16 value) { + this._nodeCnt = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setNodeCnt(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public NumaNodePolicyBuilder setNodeCnt(final Integer value) { + return setNodeCnt(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NumaNodePolicyBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NumaNodePolicyBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NumaNodePolicyBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NumaNodePolicyBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public NumaNodePolicy build() { + return new NumaNodePolicyImpl(this); + } + + private static final class NumaNodePolicyImpl + extends AbstractAugmentable + implements NumaNodePolicy { + + private final NumaNodePolicy.MemPolicy _memPolicy; + private final Map _node; + private final Uint16 _nodeCnt; + + NumaNodePolicyImpl(NumaNodePolicyBuilder base) { + super(base.augmentation); + this._memPolicy = base.getMemPolicy(); + this._node = CodeHelpers.emptyToNull(base.getNode()); + this._nodeCnt = base.getNodeCnt(); + } + + @Override + public NumaNodePolicy.MemPolicy getMemPolicy() { + return _memPolicy; + } + + @Override + public Map getNode() { + return _node; + } + + @Override + public Uint16 getNodeCnt() { + return _nodeCnt; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_memPolicy); + result = prime * result + Objects.hashCode(_node); + result = prime * result + Objects.hashCode(_nodeCnt); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!NumaNodePolicy.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + NumaNodePolicy other = (NumaNodePolicy)obj; + if (!Objects.equals(_memPolicy, other.getMemPolicy())) { + return false; + } + if (!Objects.equals(_node, other.getNode())) { + return false; + } + if (!Objects.equals(_nodeCnt, other.getNodeCnt())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NumaNodePolicyImpl otherImpl = (NumaNodePolicyImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("NumaNodePolicy"); + CodeHelpers.appendValue(helper, "_memPolicy", _memPolicy); + CodeHelpers.appendValue(helper, "_node", _node); + CodeHelpers.appendValue(helper, "_nodeCnt", _nodeCnt); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/Node.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/Node.java new file mode 100644 index 0000000000000000000000000000000000000000..3b49c7ab3c1474847f9e8ed5755a9d1f1918081a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/Node.java @@ -0,0 +1,139 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.NumaNodePolicy; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.OmNumaType; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.Vcpu; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.VcpuKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * list node {
+ *   key id;
+ *   leaf id {
+ *     type uint64;
+ *   }
+ *   list vcpu {
+ *     key id;
+ *     leaf id {
+ *       type uint64;
+ *     }
+ *   }
+ *   leaf memory-mb {
+ *     type uint64;
+ *   }
+ *   choice om-numa-type {
+ *     case cores {
+ *       leaf num-cores {
+ *         type uint8;
+ *       }
+ *     }
+ *     case paired-threads {
+ *       container paired-threads {
+ *         leaf num-paired-threads {
+ *           type uint8;
+ *         }
+ *         list paired-thread-ids {
+ *           max-elements 16;
+ *           key thread-a;
+ *           leaf thread-a {
+ *             type uint8;
+ *           }
+ *           leaf thread-b {
+ *             type uint8;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     case threads {
+ *       leaf num-threads {
+ *         type uint8;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-numa/numa-node-policy/node + * + *

To create instances of this class use {@link NodeBuilder}. + * @see NodeBuilder + * @see NodeKey + * + */ +public interface Node + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("node"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.Node.class; + } + + /** + * NUMA node identification. Typically it's 0 or 1 + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 id, or null if not present + */ + @Nullable Uint64 getId(); + + /** + * List of VCPUs to allocate on this NUMA node. + * + * + * + * @return java.util.Map vcpu, or null if not present + */ + @Nullable Map getVcpu(); + + /** + * @return java.util.Map vcpu, or an empty list if it is not present + */ + default @NonNull Map nonnullVcpu() { + return CodeHelpers.nonnull(getVcpu()); + } + + /** + * Memory size expressed in MB for this NUMA node. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 memoryMb, or null if not present + */ + @Nullable Uint64 getMemoryMb(); + + /** + * OpenMANO Numa type selection + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.OmNumaType omNumaType, or null if not present + */ + @Nullable OmNumaType getOmNumaType(); + + @Override + NodeKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/NodeBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/NodeBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..07718ed62d7c6d1227eb1828c7fdb0dda7563302 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/NodeBuilder.java @@ -0,0 +1,364 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.OmNumaType; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.Vcpu; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.VcpuKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link NodeBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NodeBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NodeBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NodeBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NodeBuilder + * @see Builder + * + */ +public class NodeBuilder implements Builder { + + private Uint64 _id; + private Uint64 _memoryMb; + private OmNumaType _omNumaType; + private Map _vcpu; + private NodeKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NodeBuilder() { + } + + public NodeBuilder(Node base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + this._memoryMb = base.getMemoryMb(); + this._omNumaType = base.getOmNumaType(); + this._vcpu = base.getVcpu(); + } + + + public NodeKey key() { + return key; + } + + public Uint64 getId() { + return _id; + } + + public Uint64 getMemoryMb() { + return _memoryMb; + } + + public OmNumaType getOmNumaType() { + return _omNumaType; + } + + public Map getVcpu() { + return _vcpu; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public NodeBuilder withKey(final NodeKey key) { + this.key = key; + return this; + } + + public NodeBuilder setId(final Uint64 value) { + this._id = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setId(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public NodeBuilder setId(final BigInteger value) { + return setId(CodeHelpers.compatUint(value)); + } + + public NodeBuilder setMemoryMb(final Uint64 value) { + this._memoryMb = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setMemoryMb(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public NodeBuilder setMemoryMb(final BigInteger value) { + return setMemoryMb(CodeHelpers.compatUint(value)); + } + + public NodeBuilder setOmNumaType(final OmNumaType value) { + this._omNumaType = value; + return this; + } + public NodeBuilder setVcpu(final Map values) { + this._vcpu = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setVcpu(Map)} instead. + */ + @Deprecated(forRemoval = true) + public NodeBuilder setVcpu(final List values) { + return setVcpu(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NodeBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NodeBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NodeBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NodeBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Node build() { + return new NodeImpl(this); + } + + private static final class NodeImpl + extends AbstractAugmentable + implements Node { + + private final Uint64 _id; + private final Uint64 _memoryMb; + private final OmNumaType _omNumaType; + private final Map _vcpu; + private final NodeKey key; + + NodeImpl(NodeBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new NodeKey(base.getId()); + } + this._id = key.getId(); + this._memoryMb = base.getMemoryMb(); + this._omNumaType = base.getOmNumaType(); + this._vcpu = CodeHelpers.emptyToNull(base.getVcpu()); + } + + @Override + public NodeKey key() { + return key; + } + + @Override + public Uint64 getId() { + return _id; + } + + @Override + public Uint64 getMemoryMb() { + return _memoryMb; + } + + @Override + public OmNumaType getOmNumaType() { + return _omNumaType; + } + + @Override + public Map getVcpu() { + return _vcpu; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(_memoryMb); + result = prime * result + Objects.hashCode(_omNumaType); + result = prime * result + Objects.hashCode(_vcpu); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Node.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Node other = (Node)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (!Objects.equals(_memoryMb, other.getMemoryMb())) { + return false; + } + if (!Objects.equals(_omNumaType, other.getOmNumaType())) { + return false; + } + if (!Objects.equals(_vcpu, other.getVcpu())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NodeImpl otherImpl = (NodeImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Node"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "_memoryMb", _memoryMb); + CodeHelpers.appendValue(helper, "_omNumaType", _omNumaType); + CodeHelpers.appendValue(helper, "_vcpu", _vcpu); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/NodeKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/NodeKey.java new file mode 100644 index 0000000000000000000000000000000000000000..a730ca0392235385a265fb6caba9950fffa13d4c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/NodeKey.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.math.BigInteger; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; +import org.opendaylight.yangtools.yang.common.Uint64; + +public class NodeKey + implements Identifier { + private static final long serialVersionUID = 7805731164917659700L; + private final Uint64 _id; + + + public NodeKey(Uint64 _id) { + + this._id = _id; + } + + /** + * Utility migration constructor. + * + * @param _id id in legacy Java type + * @deprecated Use {#link NodeKey(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public NodeKey(BigInteger _id) { + this(CodeHelpers.compatUint(_id)); + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public NodeKey(NodeKey source) { + this._id = source._id; + } + + + public Uint64 getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof NodeKey)) { + return false; + } + final NodeKey other = (NodeKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(NodeKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/OmNumaType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/OmNumaType.java new file mode 100644 index 0000000000000000000000000000000000000000..a4b45799898fc46d969ecbdecbb15d9da720af1f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/OmNumaType.java @@ -0,0 +1,58 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.Node; +import org.opendaylight.yangtools.yang.binding.ChoiceIn; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * OpenMANO Numa type selection + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * choice om-numa-type {
+ *   case cores {
+ *     leaf num-cores {
+ *       type uint8;
+ *     }
+ *   }
+ *   case paired-threads {
+ *     container paired-threads {
+ *       leaf num-paired-threads {
+ *         type uint8;
+ *       }
+ *       list paired-thread-ids {
+ *         max-elements 16;
+ *         key thread-a;
+ *         leaf thread-a {
+ *           type uint8;
+ *         }
+ *         leaf thread-b {
+ *           type uint8;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   case threads {
+ *     leaf num-threads {
+ *       type uint8;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-numa/numa-node-policy/node/om-numa-type + * + */ +public interface OmNumaType + extends + ChoiceIn +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("om-numa-type"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/Vcpu.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/Vcpu.java new file mode 100644 index 0000000000000000000000000000000000000000..1d2a2a3e82e49c52ce41d52e96e32c1fd09b1078 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/Vcpu.java @@ -0,0 +1,63 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.Node; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * List of VCPUs to allocate on this NUMA node. + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * list vcpu {
+ *   key id;
+ *   leaf id {
+ *     type uint64;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-numa/numa-node-policy/node/vcpu + * + *

To create instances of this class use {@link VcpuBuilder}. + * @see VcpuBuilder + * @see VcpuKey + * + */ +public interface Vcpu + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vcpu"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.Vcpu.class; + } + + /** + * List of VCPUs ids to allocate on this NUMA node + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint64 id, or null if not present + */ + @Nullable Uint64 getId(); + + @Override + VcpuKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/VcpuBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/VcpuBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..8261e736f49cf5892162629267893cb6507c5c68 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/VcpuBuilder.java @@ -0,0 +1,262 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link VcpuBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VcpuBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VcpuBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VcpuBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VcpuBuilder + * @see Builder + * + */ +public class VcpuBuilder implements Builder { + + private Uint64 _id; + private VcpuKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VcpuBuilder() { + } + + public VcpuBuilder(Vcpu base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + } + + + public VcpuKey key() { + return key; + } + + public Uint64 getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public VcpuBuilder withKey(final VcpuKey key) { + this.key = key; + return this; + } + + public VcpuBuilder setId(final Uint64 value) { + this._id = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setId(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public VcpuBuilder setId(final BigInteger value) { + return setId(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VcpuBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VcpuBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VcpuBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VcpuBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Vcpu build() { + return new VcpuImpl(this); + } + + private static final class VcpuImpl + extends AbstractAugmentable + implements Vcpu { + + private final Uint64 _id; + private final VcpuKey key; + + VcpuImpl(VcpuBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new VcpuKey(base.getId()); + } + this._id = key.getId(); + } + + @Override + public VcpuKey key() { + return key; + } + + @Override + public Uint64 getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vcpu.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vcpu other = (Vcpu)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VcpuImpl otherImpl = (VcpuImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vcpu"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/VcpuKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/VcpuKey.java new file mode 100644 index 0000000000000000000000000000000000000000..547220ded8ee5da3ba524194b6752a3d26bdb33d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/VcpuKey.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.math.BigInteger; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; +import org.opendaylight.yangtools.yang.common.Uint64; + +public class VcpuKey + implements Identifier { + private static final long serialVersionUID = 3724147881547077701L; + private final Uint64 _id; + + + public VcpuKey(Uint64 _id) { + + this._id = _id; + } + + /** + * Utility migration constructor. + * + * @param _id id in legacy Java type + * @deprecated Use {#link VcpuKey(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public VcpuKey(BigInteger _id) { + this(CodeHelpers.compatUint(_id)); + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public VcpuKey(VcpuKey source) { + this._id = source._id; + } + + + public Uint64 getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof VcpuKey)) { + return false; + } + final VcpuKey other = (VcpuKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(VcpuKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/Cores.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/Cores.java new file mode 100644 index 0000000000000000000000000000000000000000..b767a7937347fa2edaa10535245b2f186acd48c4 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/Cores.java @@ -0,0 +1,49 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.OmNumaType; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint8; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * case cores {
+ *   leaf num-cores {
+ *     type uint8;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-numa/numa-node-policy/node/om-numa-type/cores + * + */ +public interface Cores + extends + DataObject, + Augmentable, + OmNumaType +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("cores"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.Cores.class; + } + + /** + * @return org.opendaylight.yangtools.yang.common.Uint8 numCores, or null if not present + */ + @Nullable Uint8 getNumCores(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/CoresBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/CoresBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..e3d2577480e1675a566d9adf3a1d1d123096298c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/CoresBuilder.java @@ -0,0 +1,241 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.Short; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint8; + +/** + * Class that builds {@link CoresBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     CoresBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new CoresBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of CoresBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see CoresBuilder + * @see Builder + * + */ +public class CoresBuilder implements Builder { + + private Uint8 _numCores; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public CoresBuilder() { + } + + public CoresBuilder(Cores base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._numCores = base.getNumCores(); + } + + + public Uint8 getNumCores() { + return _numCores; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public CoresBuilder setNumCores(final Uint8 value) { + this._numCores = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setNumCores(Uint8)} instead. + */ + @Deprecated(forRemoval = true) + public CoresBuilder setNumCores(final Short value) { + return setNumCores(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public CoresBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public CoresBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public CoresBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private CoresBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Cores build() { + return new CoresImpl(this); + } + + private static final class CoresImpl + extends AbstractAugmentable + implements Cores { + + private final Uint8 _numCores; + + CoresImpl(CoresBuilder base) { + super(base.augmentation); + this._numCores = base.getNumCores(); + } + + @Override + public Uint8 getNumCores() { + return _numCores; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_numCores); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Cores.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Cores other = (Cores)obj; + if (!Objects.equals(_numCores, other.getNumCores())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + CoresImpl otherImpl = (CoresImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Cores"); + CodeHelpers.appendValue(helper, "_numCores", _numCores); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/PairedThreads.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/PairedThreads.java new file mode 100644 index 0000000000000000000000000000000000000000..1b9cacf395e80dd2e0c88660c13ebd3467d663e3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/PairedThreads.java @@ -0,0 +1,60 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.OmNumaType; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * case paired-threads {
+ *   container paired-threads {
+ *     leaf num-paired-threads {
+ *       type uint8;
+ *     }
+ *     list paired-thread-ids {
+ *       max-elements 16;
+ *       key thread-a;
+ *       leaf thread-a {
+ *         type uint8;
+ *       }
+ *       leaf thread-b {
+ *         type uint8;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-numa/numa-node-policy/node/om-numa-type/paired-threads + * + */ +public interface PairedThreads + extends + DataObject, + Augmentable, + OmNumaType +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("paired-threads"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.PairedThreads.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.PairedThreads pairedThreads, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.@Nullable PairedThreads getPairedThreads(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/PairedThreadsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/PairedThreadsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..35782d898dcd4cfa8bef0c18643d0f01f942bd6f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/PairedThreadsBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link PairedThreadsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PairedThreadsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PairedThreadsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PairedThreadsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PairedThreadsBuilder + * @see Builder + * + */ +public class PairedThreadsBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.PairedThreads _pairedThreads; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PairedThreadsBuilder() { + } + + public PairedThreadsBuilder(PairedThreads base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._pairedThreads = base.getPairedThreads(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.PairedThreads getPairedThreads() { + return _pairedThreads; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public PairedThreadsBuilder setPairedThreads(final org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.PairedThreads value) { + this._pairedThreads = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PairedThreadsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PairedThreadsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PairedThreadsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PairedThreadsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public PairedThreads build() { + return new PairedThreadsImpl(this); + } + + private static final class PairedThreadsImpl + extends AbstractAugmentable + implements PairedThreads { + + private final org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.PairedThreads _pairedThreads; + + PairedThreadsImpl(PairedThreadsBuilder base) { + super(base.augmentation); + this._pairedThreads = base.getPairedThreads(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.PairedThreads getPairedThreads() { + return _pairedThreads; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_pairedThreads); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!PairedThreads.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + PairedThreads other = (PairedThreads)obj; + if (!Objects.equals(_pairedThreads, other.getPairedThreads())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PairedThreadsImpl otherImpl = (PairedThreadsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("PairedThreads"); + CodeHelpers.appendValue(helper, "_pairedThreads", _pairedThreads); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/Threads.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/Threads.java new file mode 100644 index 0000000000000000000000000000000000000000..77cf6fde361c8f25634fb6eba672680319f694b0 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/Threads.java @@ -0,0 +1,49 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.OmNumaType; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint8; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * case threads {
+ *   leaf num-threads {
+ *     type uint8;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-numa/numa-node-policy/node/om-numa-type/threads + * + */ +public interface Threads + extends + DataObject, + Augmentable, + OmNumaType +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("threads"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.Threads.class; + } + + /** + * @return org.opendaylight.yangtools.yang.common.Uint8 numThreads, or null if not present + */ + @Nullable Uint8 getNumThreads(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/ThreadsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/ThreadsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..1006005878a46efb4792f241efe0cef7ec7c6790 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/ThreadsBuilder.java @@ -0,0 +1,241 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.Short; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint8; + +/** + * Class that builds {@link ThreadsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ThreadsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ThreadsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ThreadsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ThreadsBuilder + * @see Builder + * + */ +public class ThreadsBuilder implements Builder { + + private Uint8 _numThreads; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ThreadsBuilder() { + } + + public ThreadsBuilder(Threads base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._numThreads = base.getNumThreads(); + } + + + public Uint8 getNumThreads() { + return _numThreads; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public ThreadsBuilder setNumThreads(final Uint8 value) { + this._numThreads = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setNumThreads(Uint8)} instead. + */ + @Deprecated(forRemoval = true) + public ThreadsBuilder setNumThreads(final Short value) { + return setNumThreads(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ThreadsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ThreadsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ThreadsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ThreadsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Threads build() { + return new ThreadsImpl(this); + } + + private static final class ThreadsImpl + extends AbstractAugmentable + implements Threads { + + private final Uint8 _numThreads; + + ThreadsImpl(ThreadsBuilder base) { + super(base.augmentation); + this._numThreads = base.getNumThreads(); + } + + @Override + public Uint8 getNumThreads() { + return _numThreads; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_numThreads); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Threads.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Threads other = (Threads)obj; + if (!Objects.equals(_numThreads, other.getNumThreads())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ThreadsImpl otherImpl = (ThreadsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Threads"); + CodeHelpers.appendValue(helper, "_numThreads", _numThreads); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/PairedThreads.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/PairedThreads.java new file mode 100644 index 0000000000000000000000000000000000000000..d04f5764cad794f61628e77a84fa1e62bf36afac --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/PairedThreads.java @@ -0,0 +1,81 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.Node; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.paired.threads.PairedThreadIds; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.paired.threads.PairedThreadIdsKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint8; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * container paired-threads {
+ *   leaf num-paired-threads {
+ *     type uint8;
+ *   }
+ *   list paired-thread-ids {
+ *     max-elements 16;
+ *     key thread-a;
+ *     leaf thread-a {
+ *       type uint8;
+ *     }
+ *     leaf thread-b {
+ *       type uint8;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-numa/numa-node-policy/node/om-numa-type/paired-threads/paired-threads + * + *

To create instances of this class use {@link PairedThreadsBuilder}. + * @see PairedThreadsBuilder + * + */ +public interface PairedThreads + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("paired-threads"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.PairedThreads.class; + } + + /** + * @return org.opendaylight.yangtools.yang.common.Uint8 numPairedThreads, or null if not present + */ + @Nullable Uint8 getNumPairedThreads(); + + /** + * List of thread pairs to use in case of paired-thread NUMA + * + * + * + * @return java.util.Map pairedThreadIds, or null if not present + */ + @Nullable Map getPairedThreadIds(); + + /** + * @return java.util.Map pairedThreadIds, or an empty list if it is not present + */ + default @NonNull Map nonnullPairedThreadIds() { + return CodeHelpers.nonnull(getPairedThreadIds()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/PairedThreadsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/PairedThreadsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..36db1223f8b63f623a8c727d1728c8fe80059395 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/PairedThreadsBuilder.java @@ -0,0 +1,284 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.Short; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.paired.threads.PairedThreadIds; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.paired.threads.PairedThreadIdsKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint8; + +/** + * Class that builds {@link PairedThreadsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PairedThreadsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PairedThreadsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PairedThreadsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PairedThreadsBuilder + * @see Builder + * + */ +public class PairedThreadsBuilder implements Builder { + + private Uint8 _numPairedThreads; + private Map _pairedThreadIds; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PairedThreadsBuilder() { + } + + public PairedThreadsBuilder(PairedThreads base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._numPairedThreads = base.getNumPairedThreads(); + this._pairedThreadIds = base.getPairedThreadIds(); + } + + + public Uint8 getNumPairedThreads() { + return _numPairedThreads; + } + + public Map getPairedThreadIds() { + return _pairedThreadIds; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public PairedThreadsBuilder setNumPairedThreads(final Uint8 value) { + this._numPairedThreads = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setNumPairedThreads(Uint8)} instead. + */ + @Deprecated(forRemoval = true) + public PairedThreadsBuilder setNumPairedThreads(final Short value) { + return setNumPairedThreads(CodeHelpers.compatUint(value)); + } + public PairedThreadsBuilder setPairedThreadIds(final Map values) { + this._pairedThreadIds = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setPairedThreadIds(Map)} instead. + */ + @Deprecated(forRemoval = true) + public PairedThreadsBuilder setPairedThreadIds(final List values) { + return setPairedThreadIds(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PairedThreadsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PairedThreadsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PairedThreadsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PairedThreadsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public PairedThreads build() { + return new PairedThreadsImpl(this); + } + + private static final class PairedThreadsImpl + extends AbstractAugmentable + implements PairedThreads { + + private final Uint8 _numPairedThreads; + private final Map _pairedThreadIds; + + PairedThreadsImpl(PairedThreadsBuilder base) { + super(base.augmentation); + this._numPairedThreads = base.getNumPairedThreads(); + this._pairedThreadIds = CodeHelpers.emptyToNull(base.getPairedThreadIds()); + } + + @Override + public Uint8 getNumPairedThreads() { + return _numPairedThreads; + } + + @Override + public Map getPairedThreadIds() { + return _pairedThreadIds; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_numPairedThreads); + result = prime * result + Objects.hashCode(_pairedThreadIds); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!PairedThreads.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + PairedThreads other = (PairedThreads)obj; + if (!Objects.equals(_numPairedThreads, other.getNumPairedThreads())) { + return false; + } + if (!Objects.equals(_pairedThreadIds, other.getPairedThreadIds())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PairedThreadsImpl otherImpl = (PairedThreadsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("PairedThreads"); + CodeHelpers.appendValue(helper, "_numPairedThreads", _numPairedThreads); + CodeHelpers.appendValue(helper, "_pairedThreadIds", _pairedThreadIds); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/paired/threads/PairedThreadIds.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/paired/threads/PairedThreadIds.java new file mode 100644 index 0000000000000000000000000000000000000000..d27345f98b3ac6fbdf93c0b965479a38f67a4717 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/paired/threads/PairedThreadIds.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.paired.threads; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.PairedThreads; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint8; + +/** + * List of thread pairs to use in case of paired-thread NUMA + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * list paired-thread-ids {
+ *   max-elements 16;
+ *   key thread-a;
+ *   leaf thread-a {
+ *     type uint8;
+ *   }
+ *   leaf thread-b {
+ *     type uint8;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-numa/numa-node-policy/node/om-numa-type/paired-threads/paired-threads/paired-thread-ids + * + *

To create instances of this class use {@link PairedThreadIdsBuilder}. + * @see PairedThreadIdsBuilder + * @see PairedThreadIdsKey + * + */ +public interface PairedThreadIds + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("paired-thread-ids"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.paired.threads.PairedThreadIds.class; + } + + /** + * @return org.opendaylight.yangtools.yang.common.Uint8 threadA, or null if not present + */ + @Nullable Uint8 getThreadA(); + + /** + * @return org.opendaylight.yangtools.yang.common.Uint8 threadB, or null if not present + */ + @Nullable Uint8 getThreadB(); + + @Override + PairedThreadIdsKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/paired/threads/PairedThreadIdsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/paired/threads/PairedThreadIdsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..0a150be21a53754355f0ffa1aefb158ed4db5cfb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/paired/threads/PairedThreadIdsBuilder.java @@ -0,0 +1,297 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.paired.threads; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.Short; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint8; + +/** + * Class that builds {@link PairedThreadIdsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     PairedThreadIdsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new PairedThreadIdsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of PairedThreadIdsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see PairedThreadIdsBuilder + * @see Builder + * + */ +public class PairedThreadIdsBuilder implements Builder { + + private Uint8 _threadA; + private Uint8 _threadB; + private PairedThreadIdsKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public PairedThreadIdsBuilder() { + } + + public PairedThreadIdsBuilder(PairedThreadIds base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._threadA = base.getThreadA(); + this._threadB = base.getThreadB(); + } + + + public PairedThreadIdsKey key() { + return key; + } + + public Uint8 getThreadA() { + return _threadA; + } + + public Uint8 getThreadB() { + return _threadB; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public PairedThreadIdsBuilder withKey(final PairedThreadIdsKey key) { + this.key = key; + return this; + } + + public PairedThreadIdsBuilder setThreadA(final Uint8 value) { + this._threadA = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setThreadA(Uint8)} instead. + */ + @Deprecated(forRemoval = true) + public PairedThreadIdsBuilder setThreadA(final Short value) { + return setThreadA(CodeHelpers.compatUint(value)); + } + + public PairedThreadIdsBuilder setThreadB(final Uint8 value) { + this._threadB = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setThreadB(Uint8)} instead. + */ + @Deprecated(forRemoval = true) + public PairedThreadIdsBuilder setThreadB(final Short value) { + return setThreadB(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public PairedThreadIdsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public PairedThreadIdsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public PairedThreadIdsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private PairedThreadIdsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public PairedThreadIds build() { + return new PairedThreadIdsImpl(this); + } + + private static final class PairedThreadIdsImpl + extends AbstractAugmentable + implements PairedThreadIds { + + private final Uint8 _threadA; + private final Uint8 _threadB; + private final PairedThreadIdsKey key; + + PairedThreadIdsImpl(PairedThreadIdsBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new PairedThreadIdsKey(base.getThreadA()); + } + this._threadA = key.getThreadA(); + this._threadB = base.getThreadB(); + } + + @Override + public PairedThreadIdsKey key() { + return key; + } + + @Override + public Uint8 getThreadA() { + return _threadA; + } + + @Override + public Uint8 getThreadB() { + return _threadB; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_threadA); + result = prime * result + Objects.hashCode(_threadB); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!PairedThreadIds.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + PairedThreadIds other = (PairedThreadIds)obj; + if (!Objects.equals(_threadA, other.getThreadA())) { + return false; + } + if (!Objects.equals(_threadB, other.getThreadB())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + PairedThreadIdsImpl otherImpl = (PairedThreadIdsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("PairedThreadIds"); + CodeHelpers.appendValue(helper, "_threadA", _threadA); + CodeHelpers.appendValue(helper, "_threadB", _threadB); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/paired/threads/PairedThreadIdsKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/paired/threads/PairedThreadIdsKey.java new file mode 100644 index 0000000000000000000000000000000000000000..2946c4ac8284fc774a822546dd46846537939e79 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/numa/numa/node/policy/node/om/numa/type/paired/threads/paired/threads/PairedThreadIdsKey.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.numa.numa.node.policy.node.om.numa.type.paired.threads.paired.threads; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.Short; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; +import org.opendaylight.yangtools.yang.common.Uint8; + +public class PairedThreadIdsKey + implements Identifier { + private static final long serialVersionUID = 5657393331481948923L; + private final Uint8 _threadA; + + + public PairedThreadIdsKey(Uint8 _threadA) { + + this._threadA = _threadA; + } + + /** + * Utility migration constructor. + * + * @param _threadA threadA in legacy Java type + * @deprecated Use {#link PairedThreadIdsKey(Uint8)} instead. + */ + @Deprecated(forRemoval = true) + public PairedThreadIdsKey(Short _threadA) { + this(CodeHelpers.compatUint(_threadA)); + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public PairedThreadIdsKey(PairedThreadIdsKey source) { + this._threadA = source._threadA; + } + + + public Uint8 getThreadA() { + return _threadA; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_threadA); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof PairedThreadIdsKey)) { + return false; + } + final PairedThreadIdsKey other = (PairedThreadIdsKey) obj; + if (!Objects.equals(_threadA, other._threadA)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(PairedThreadIdsKey.class); + CodeHelpers.appendValue(helper, "_threadA", _threadA); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/vif/quota/VifQuota.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/vif/quota/VifQuota.java new file mode 100644 index 0000000000000000000000000000000000000000..71caaee53441ef089b52c28682d00841672182e2 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/vif/quota/VifQuota.java @@ -0,0 +1,46 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.vif.quota; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.ExtendedVifQuota; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Virtual interfaces quota describes the virtual interface bandwidth resource + * allocation policy. Limit and Reserve values are defined in Mbps + * + *

+ * This class represents the following YANG schema fragment defined in module epa + *

+ * container vif-quota {
+ *   uses allocation-properties;
+ * }
+ * 
The schema path to identify an instance is + * epa/extended-vif-quota/vif-quota + * + *

To create instances of this class use {@link VifQuotaBuilder}. + * @see VifQuotaBuilder + * + */ +public interface VifQuota + extends + ChildOf, + Augmentable, + AllocationProperties +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vif-quota"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.vif.quota.VifQuota.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/vif/quota/VifQuotaBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/vif/quota/VifQuotaBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..fdf45853a9a40420eb7bed8a05b1167cf3202248 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/epa/norev/extended/vif/quota/VifQuotaBuilder.java @@ -0,0 +1,335 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.extended.vif.quota; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint64; + +/** + * Class that builds {@link VifQuotaBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VifQuotaBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VifQuotaBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VifQuotaBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VifQuotaBuilder + * @see Builder + * + */ +public class VifQuotaBuilder implements Builder { + + private Uint64 _limit; + private Uint64 _reserve; + private Uint64 _shares; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VifQuotaBuilder() { + } + public VifQuotaBuilder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties arg) { + this._limit = arg.getLimit(); + this._reserve = arg.getReserve(); + this._shares = arg.getShares(); + } + + public VifQuotaBuilder(VifQuota base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._limit = base.getLimit(); + this._reserve = base.getReserve(); + this._shares = base.getShares(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties) { + this._limit = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getLimit(); + this._reserve = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getReserve(); + this._shares = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties)arg).getShares(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.epa.norev.AllocationProperties]"); + } + + public Uint64 getLimit() { + return _limit; + } + + public Uint64 getReserve() { + return _reserve; + } + + public Uint64 getShares() { + return _shares; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VifQuotaBuilder setLimit(final Uint64 value) { + this._limit = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setLimit(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public VifQuotaBuilder setLimit(final BigInteger value) { + return setLimit(CodeHelpers.compatUint(value)); + } + + public VifQuotaBuilder setReserve(final Uint64 value) { + this._reserve = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setReserve(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public VifQuotaBuilder setReserve(final BigInteger value) { + return setReserve(CodeHelpers.compatUint(value)); + } + + public VifQuotaBuilder setShares(final Uint64 value) { + this._shares = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setShares(Uint64)} instead. + */ + @Deprecated(forRemoval = true) + public VifQuotaBuilder setShares(final BigInteger value) { + return setShares(CodeHelpers.compatUint(value)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VifQuotaBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VifQuotaBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VifQuotaBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VifQuotaBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VifQuota build() { + return new VifQuotaImpl(this); + } + + private static final class VifQuotaImpl + extends AbstractAugmentable + implements VifQuota { + + private final Uint64 _limit; + private final Uint64 _reserve; + private final Uint64 _shares; + + VifQuotaImpl(VifQuotaBuilder base) { + super(base.augmentation); + this._limit = base.getLimit(); + this._reserve = base.getReserve(); + this._shares = base.getShares(); + } + + @Override + public Uint64 getLimit() { + return _limit; + } + + @Override + public Uint64 getReserve() { + return _reserve; + } + + @Override + public Uint64 getShares() { + return _shares; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_limit); + result = prime * result + Objects.hashCode(_reserve); + result = prime * result + Objects.hashCode(_shares); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VifQuota.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VifQuota other = (VifQuota)obj; + if (!Objects.equals(_limit, other.getLimit())) { + return false; + } + if (!Objects.equals(_reserve, other.getReserve())) { + return false; + } + if (!Objects.equals(_shares, other.getShares())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VifQuotaImpl otherImpl = (VifQuotaImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VifQuota"); + CodeHelpers.appendValue(helper, "_limit", _limit); + CodeHelpers.appendValue(helper, "_reserve", _reserve); + CodeHelpers.appendValue(helper, "_shares", _shares); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..9cb0a87fe441ea2cc73b7fddfb748cbd90e55d02 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..cd7edea753328fbaabe910c5d41f1d9a5ecedc6e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/$YangModuleInfoImpl.java @@ -0,0 +1,49 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:osm:yang:augments:ip-profiles", "ip-profiles").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.nsd.rev190425.$YangModuleInfoImpl.getInstance()); + set.add(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.$YangModuleInfoImpl.getInstance()); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/ip-profiles.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/ExtendedVldProtocolData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/ExtendedVldProtocolData.java new file mode 100644 index 0000000000000000000000000000000000000000..0bbb6b04ac543da426d7cc582b392ad6391428cf --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/ExtendedVldProtocolData.java @@ -0,0 +1,105 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.VirtualLinkProtocolData; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module ip-profiles + *

+ * grouping extended-vld-protocol-data {
+ *   container virtual-link-protocol-data {
+ *     leaf associated-layer-protocol {
+ *       type identityref {
+ *         base layer-protocol;
+ *       }
+ *     }
+ *     container l2-protocol-data {
+ *       when "(../associated-layer-protocol = 'Ethernet') or (../associated-layer-protocol = 'MPLS') or (../associated-layer-protocol = 'ODU2') or (../associated-layer-protocol = 'Pseudo-Wire')";
+ *       leaf name {
+ *         type string;
+ *       }
+ *       leaf network-type {
+ *         type enumeration {
+ *           enum flat;
+ *           enum vlan;
+ *           enum vxlan;
+ *           enum gre;
+ *         }
+ *       }
+ *       leaf vlan-transparent {
+ *         type boolean;
+ *       }
+ *       leaf mtu {
+ *         type uint16;
+ *       }
+ *     }
+ *     container l3-protocol-data {
+ *       when "(../associated-layer-protocol = 'IPv4') or (../associated-layer-protocol = 'IPv6')";
+ *       leaf name {
+ *         type string;
+ *       }
+ *       leaf ip-version {
+ *         type enumeration {
+ *           enum ipv4;
+ *           enum ipv6;
+ *         }
+ *         default ipv4;
+ *       }
+ *       leaf cidr {
+ *         type string;
+ *       }
+ *       leaf-list ip-allocation-pools {
+ *         type string;
+ *       }
+ *       leaf gateway-ip {
+ *         type inet:ip-address;
+ *       }
+ *       leaf dhcp-enabled {
+ *         type boolean;
+ *         default true;
+ *       }
+ *       leaf ipv6-address-mode {
+ *         when "../ip-version = 'ipv6'";
+ *         type enumeration {
+ *           enum slaac;
+ *           enum dhcpv6-stateful;
+ *           enum dhcpv6-stateless;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * ip-profiles/extended-vld-protocol-data + * + */ +public interface ExtendedVldProtocolData + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-vld-protocol-data"); + + @Override + Class implementedInterface(); + + /** + * Specifies the protocol data for a VL instantiated according to this profile. + * Cardinality 0 is used when no protocol data needs to be specified. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.VirtualLinkProtocolData virtualLinkProtocolData, or null if not present + */ + @Nullable VirtualLinkProtocolData getVirtualLinkProtocolData(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/VirtualLinkProfile1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/VirtualLinkProfile1.java new file mode 100644 index 0000000000000000000000000000000000000000..ccbaf2d5af0f8a76f49f83460efb23749b87d49f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/VirtualLinkProfile1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.nsd.df.VirtualLinkProfile; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface VirtualLinkProfile1 + extends + Augmentation, + ExtendedVldProtocolData +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.VirtualLinkProfile1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/VirtualLinkProfile1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/VirtualLinkProfile1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..96737c1a7fd92d78a5af6b51fa4f7224f045adf6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/VirtualLinkProfile1Builder.java @@ -0,0 +1,158 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.VirtualLinkProtocolData; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualLinkProfile1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkProfile1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkProfile1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkProfile1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkProfile1Builder + * @see Builder + * + */ +public class VirtualLinkProfile1Builder implements Builder { + + private VirtualLinkProtocolData _virtualLinkProtocolData; + + + + public VirtualLinkProfile1Builder() { + } + public VirtualLinkProfile1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.ExtendedVldProtocolData arg) { + this._virtualLinkProtocolData = arg.getVirtualLinkProtocolData(); + } + + public VirtualLinkProfile1Builder(VirtualLinkProfile1 base) { + this._virtualLinkProtocolData = base.getVirtualLinkProtocolData(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.ExtendedVldProtocolData
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.ExtendedVldProtocolData) { + this._virtualLinkProtocolData = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.ExtendedVldProtocolData)arg).getVirtualLinkProtocolData(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.ExtendedVldProtocolData]"); + } + + public VirtualLinkProtocolData getVirtualLinkProtocolData() { + return _virtualLinkProtocolData; + } + + + public VirtualLinkProfile1Builder setVirtualLinkProtocolData(final VirtualLinkProtocolData value) { + this._virtualLinkProtocolData = value; + return this; + } + + + @Override + public VirtualLinkProfile1 build() { + return new VirtualLinkProfile1Impl(this); + } + + private static final class VirtualLinkProfile1Impl + implements VirtualLinkProfile1 { + + private final VirtualLinkProtocolData _virtualLinkProtocolData; + + VirtualLinkProfile1Impl(VirtualLinkProfile1Builder base) { + this._virtualLinkProtocolData = base.getVirtualLinkProtocolData(); + } + + @Override + public VirtualLinkProtocolData getVirtualLinkProtocolData() { + return _virtualLinkProtocolData; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_virtualLinkProtocolData); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkProfile1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkProfile1 other = (VirtualLinkProfile1)obj; + if (!Objects.equals(_virtualLinkProtocolData, other.getVirtualLinkProtocolData())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkProfile1"); + CodeHelpers.appendValue(helper, "_virtualLinkProtocolData", _virtualLinkProtocolData); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/VirtualLinkProtocolData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/VirtualLinkProtocolData.java new file mode 100644 index 0000000000000000000000000000000000000000..5f880406f3d5afdbc51b371947fb08bcb3b9419c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/VirtualLinkProtocolData.java @@ -0,0 +1,137 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.ExtendedVldProtocolData; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data.L2ProtocolData; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data.L3ProtocolData; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies the protocol data for a VL instantiated according to this profile. + * Cardinality 0 is used when no protocol data needs to be specified. + * + *

+ * This class represents the following YANG schema fragment defined in module ip-profiles + *

+ * container virtual-link-protocol-data {
+ *   leaf associated-layer-protocol {
+ *     type identityref {
+ *       base layer-protocol;
+ *     }
+ *   }
+ *   container l2-protocol-data {
+ *     when "(../associated-layer-protocol = 'Ethernet') or (../associated-layer-protocol = 'MPLS') or (../associated-layer-protocol = 'ODU2') or (../associated-layer-protocol = 'Pseudo-Wire')";
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf network-type {
+ *       type enumeration {
+ *         enum flat;
+ *         enum vlan;
+ *         enum vxlan;
+ *         enum gre;
+ *       }
+ *     }
+ *     leaf vlan-transparent {
+ *       type boolean;
+ *     }
+ *     leaf mtu {
+ *       type uint16;
+ *     }
+ *   }
+ *   container l3-protocol-data {
+ *     when "(../associated-layer-protocol = 'IPv4') or (../associated-layer-protocol = 'IPv6')";
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf ip-version {
+ *       type enumeration {
+ *         enum ipv4;
+ *         enum ipv6;
+ *       }
+ *       default ipv4;
+ *     }
+ *     leaf cidr {
+ *       type string;
+ *     }
+ *     leaf-list ip-allocation-pools {
+ *       type string;
+ *     }
+ *     leaf gateway-ip {
+ *       type inet:ip-address;
+ *     }
+ *     leaf dhcp-enabled {
+ *       type boolean;
+ *       default true;
+ *     }
+ *     leaf ipv6-address-mode {
+ *       when "../ip-version = 'ipv6'";
+ *       type enumeration {
+ *         enum slaac;
+ *         enum dhcpv6-stateful;
+ *         enum dhcpv6-stateless;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * ip-profiles/extended-vld-protocol-data/virtual-link-protocol-data + * + *

To create instances of this class use {@link VirtualLinkProtocolDataBuilder}. + * @see VirtualLinkProtocolDataBuilder + * + */ +public interface VirtualLinkProtocolData + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-link-protocol-data"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.VirtualLinkProtocolData.class; + } + + /** + * One of the values of the attribute layerProtocol of the ConnectivityType IE. + * + * + * + * @return java.lang.Class associatedLayerProtocol, or null if not present + */ + @Nullable Class getAssociatedLayerProtocol(); + + /** + * Specifies the L2 protocol data for this virtual link. Shall be present when the + * associatedLayerProtocol attribute indicates a L2 protocol and shall be absent + * otherwise. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data.L2ProtocolData l2ProtocolData, or null if not present + */ + @Nullable L2ProtocolData getL2ProtocolData(); + + /** + * Specifies the L3 protocol data for this virtual link. Shall be present when the + * associatedLayerProtocol attribute indicates a L3 protocol and shall be absent + * otherwise. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data.L3ProtocolData l3ProtocolData, or null if not present + */ + @Nullable L3ProtocolData getL3ProtocolData(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/VirtualLinkProtocolDataBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/VirtualLinkProtocolDataBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..3663d17b2620d265d4d1115349ab24a52ca1e10e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/VirtualLinkProtocolDataBuilder.java @@ -0,0 +1,276 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.descriptors.rev190425.LayerProtocol; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data.L2ProtocolData; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data.L3ProtocolData; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link VirtualLinkProtocolDataBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     VirtualLinkProtocolDataBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new VirtualLinkProtocolDataBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of VirtualLinkProtocolDataBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see VirtualLinkProtocolDataBuilder + * @see Builder + * + */ +public class VirtualLinkProtocolDataBuilder implements Builder { + + private Class _associatedLayerProtocol; + private L2ProtocolData _l2ProtocolData; + private L3ProtocolData _l3ProtocolData; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public VirtualLinkProtocolDataBuilder() { + } + + public VirtualLinkProtocolDataBuilder(VirtualLinkProtocolData base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._associatedLayerProtocol = base.getAssociatedLayerProtocol(); + this._l2ProtocolData = base.getL2ProtocolData(); + this._l3ProtocolData = base.getL3ProtocolData(); + } + + + public Class getAssociatedLayerProtocol() { + return _associatedLayerProtocol; + } + + public L2ProtocolData getL2ProtocolData() { + return _l2ProtocolData; + } + + public L3ProtocolData getL3ProtocolData() { + return _l3ProtocolData; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public VirtualLinkProtocolDataBuilder setAssociatedLayerProtocol(final Class value) { + this._associatedLayerProtocol = value; + return this; + } + + public VirtualLinkProtocolDataBuilder setL2ProtocolData(final L2ProtocolData value) { + this._l2ProtocolData = value; + return this; + } + + public VirtualLinkProtocolDataBuilder setL3ProtocolData(final L3ProtocolData value) { + this._l3ProtocolData = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public VirtualLinkProtocolDataBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public VirtualLinkProtocolDataBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public VirtualLinkProtocolDataBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private VirtualLinkProtocolDataBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public VirtualLinkProtocolData build() { + return new VirtualLinkProtocolDataImpl(this); + } + + private static final class VirtualLinkProtocolDataImpl + extends AbstractAugmentable + implements VirtualLinkProtocolData { + + private final Class _associatedLayerProtocol; + private final L2ProtocolData _l2ProtocolData; + private final L3ProtocolData _l3ProtocolData; + + VirtualLinkProtocolDataImpl(VirtualLinkProtocolDataBuilder base) { + super(base.augmentation); + this._associatedLayerProtocol = base.getAssociatedLayerProtocol(); + this._l2ProtocolData = base.getL2ProtocolData(); + this._l3ProtocolData = base.getL3ProtocolData(); + } + + @Override + public Class getAssociatedLayerProtocol() { + return _associatedLayerProtocol; + } + + @Override + public L2ProtocolData getL2ProtocolData() { + return _l2ProtocolData; + } + + @Override + public L3ProtocolData getL3ProtocolData() { + return _l3ProtocolData; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_associatedLayerProtocol); + result = prime * result + Objects.hashCode(_l2ProtocolData); + result = prime * result + Objects.hashCode(_l3ProtocolData); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!VirtualLinkProtocolData.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + VirtualLinkProtocolData other = (VirtualLinkProtocolData)obj; + if (!Objects.equals(_associatedLayerProtocol, other.getAssociatedLayerProtocol())) { + return false; + } + if (!Objects.equals(_l2ProtocolData, other.getL2ProtocolData())) { + return false; + } + if (!Objects.equals(_l3ProtocolData, other.getL3ProtocolData())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + VirtualLinkProtocolDataImpl otherImpl = (VirtualLinkProtocolDataImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("VirtualLinkProtocolData"); + CodeHelpers.appendValue(helper, "_associatedLayerProtocol", _associatedLayerProtocol); + CodeHelpers.appendValue(helper, "_l2ProtocolData", _l2ProtocolData); + CodeHelpers.appendValue(helper, "_l3ProtocolData", _l3ProtocolData); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L2ProtocolData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L2ProtocolData.java new file mode 100644 index 0000000000000000000000000000000000000000..31ee3e9eabf4a42ee724476a358e3f940a56c19c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L2ProtocolData.java @@ -0,0 +1,174 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.VirtualLinkProtocolData; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Specifies the L2 protocol data for this virtual link. Shall be present when the + * associatedLayerProtocol attribute indicates a L2 protocol and shall be absent + * otherwise. + * + *

+ * This class represents the following YANG schema fragment defined in module ip-profiles + *

+ * container l2-protocol-data {
+ *   when "(../associated-layer-protocol = 'Ethernet') or (../associated-layer-protocol = 'MPLS') or (../associated-layer-protocol = 'ODU2') or (../associated-layer-protocol = 'Pseudo-Wire')";
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf network-type {
+ *     type enumeration {
+ *       enum flat;
+ *       enum vlan;
+ *       enum vxlan;
+ *       enum gre;
+ *     }
+ *   }
+ *   leaf vlan-transparent {
+ *     type boolean;
+ *   }
+ *   leaf mtu {
+ *     type uint16;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * ip-profiles/extended-vld-protocol-data/virtual-link-protocol-data/l2-protocol-data + * + *

To create instances of this class use {@link L2ProtocolDataBuilder}. + * @see L2ProtocolDataBuilder + * + */ +public interface L2ProtocolData + extends + ChildOf, + Augmentable +{ + + + public enum NetworkType implements Enumeration { + Flat(0, "flat"), + + Vlan(1, "vlan"), + + Vxlan(2, "vxlan"), + + Gre(3, "gre") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (NetworkType enumItem : NetworkType.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private NetworkType(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding NetworkType item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding NetworkType item, or null if no such item exists + */ + public static NetworkType forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("l2-protocol-data"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data.L2ProtocolData.class; + } + + /** + * Network name associated with this L2 protocol. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Specifies the network type for this L2 protocol. Possible values: FLAT, VLAN, + * VXLAN, GRE. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data.L2ProtocolData.NetworkType networkType, or null if not present + */ + @Nullable NetworkType getNetworkType(); + + /** + * Specifies whether to support VLAN transparency for this L2 protocol or not. + * + * + * + * @return java.lang.Boolean vlanTransparent, or null if not present + */ + @Nullable Boolean isVlanTransparent(); + + /** + * Specifies the maximum transmission unit (MTU) value for this L2 protocol. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint16 mtu, or null if not present + */ + @Nullable Uint16 getMtu(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L2ProtocolDataBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L2ProtocolDataBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..91cf05c6eb2cd2845f2f04cbff2fa771f608d214 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L2ProtocolDataBuilder.java @@ -0,0 +1,311 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Integer; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.Uint16; + +/** + * Class that builds {@link L2ProtocolDataBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     L2ProtocolDataBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new L2ProtocolDataBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of L2ProtocolDataBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see L2ProtocolDataBuilder + * @see Builder + * + */ +public class L2ProtocolDataBuilder implements Builder { + + private Uint16 _mtu; + private String _name; + private L2ProtocolData.NetworkType _networkType; + private Boolean _vlanTransparent; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public L2ProtocolDataBuilder() { + } + + public L2ProtocolDataBuilder(L2ProtocolData base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._mtu = base.getMtu(); + this._name = base.getName(); + this._networkType = base.getNetworkType(); + this._vlanTransparent = base.isVlanTransparent(); + } + + + public Uint16 getMtu() { + return _mtu; + } + + public String getName() { + return _name; + } + + public L2ProtocolData.NetworkType getNetworkType() { + return _networkType; + } + + public Boolean isVlanTransparent() { + return _vlanTransparent; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public L2ProtocolDataBuilder setMtu(final Uint16 value) { + this._mtu = value; + return this; + } + + /** + * Utility migration setter. + * + * @param value field value in legacy type + * @return this builder + * @deprecated Use {#link setMtu(Uint16)} instead. + */ + @Deprecated(forRemoval = true) + public L2ProtocolDataBuilder setMtu(final Integer value) { + return setMtu(CodeHelpers.compatUint(value)); + } + + public L2ProtocolDataBuilder setName(final String value) { + this._name = value; + return this; + } + + public L2ProtocolDataBuilder setNetworkType(final L2ProtocolData.NetworkType value) { + this._networkType = value; + return this; + } + + public L2ProtocolDataBuilder setVlanTransparent(final Boolean value) { + this._vlanTransparent = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public L2ProtocolDataBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public L2ProtocolDataBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public L2ProtocolDataBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private L2ProtocolDataBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public L2ProtocolData build() { + return new L2ProtocolDataImpl(this); + } + + private static final class L2ProtocolDataImpl + extends AbstractAugmentable + implements L2ProtocolData { + + private final Uint16 _mtu; + private final String _name; + private final L2ProtocolData.NetworkType _networkType; + private final Boolean _vlanTransparent; + + L2ProtocolDataImpl(L2ProtocolDataBuilder base) { + super(base.augmentation); + this._mtu = base.getMtu(); + this._name = base.getName(); + this._networkType = base.getNetworkType(); + this._vlanTransparent = base.isVlanTransparent(); + } + + @Override + public Uint16 getMtu() { + return _mtu; + } + + @Override + public String getName() { + return _name; + } + + @Override + public L2ProtocolData.NetworkType getNetworkType() { + return _networkType; + } + + @Override + public Boolean isVlanTransparent() { + return _vlanTransparent; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_mtu); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_networkType); + result = prime * result + Objects.hashCode(_vlanTransparent); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!L2ProtocolData.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + L2ProtocolData other = (L2ProtocolData)obj; + if (!Objects.equals(_mtu, other.getMtu())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_networkType, other.getNetworkType())) { + return false; + } + if (!Objects.equals(_vlanTransparent, other.isVlanTransparent())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + L2ProtocolDataImpl otherImpl = (L2ProtocolDataImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("L2ProtocolData"); + CodeHelpers.appendValue(helper, "_mtu", _mtu); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_networkType", _networkType); + CodeHelpers.appendValue(helper, "_vlanTransparent", _vlanTransparent); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L3ProtocolData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L3ProtocolData.java new file mode 100644 index 0000000000000000000000000000000000000000..4607ad8262c9aeeeff2f15488e1b60fc4debaaef --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L3ProtocolData.java @@ -0,0 +1,278 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.VirtualLinkProtocolData; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Specifies the L3 protocol data for this virtual link. Shall be present when the + * associatedLayerProtocol attribute indicates a L3 protocol and shall be absent + * otherwise. + * + *

+ * This class represents the following YANG schema fragment defined in module ip-profiles + *

+ * container l3-protocol-data {
+ *   when "(../associated-layer-protocol = 'IPv4') or (../associated-layer-protocol = 'IPv6')";
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf ip-version {
+ *     type enumeration {
+ *       enum ipv4;
+ *       enum ipv6;
+ *     }
+ *     default ipv4;
+ *   }
+ *   leaf cidr {
+ *     type string;
+ *   }
+ *   leaf-list ip-allocation-pools {
+ *     type string;
+ *   }
+ *   leaf gateway-ip {
+ *     type inet:ip-address;
+ *   }
+ *   leaf dhcp-enabled {
+ *     type boolean;
+ *     default true;
+ *   }
+ *   leaf ipv6-address-mode {
+ *     when "../ip-version = 'ipv6'";
+ *     type enumeration {
+ *       enum slaac;
+ *       enum dhcpv6-stateful;
+ *       enum dhcpv6-stateless;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * ip-profiles/extended-vld-protocol-data/virtual-link-protocol-data/l3-protocol-data + * + *

To create instances of this class use {@link L3ProtocolDataBuilder}. + * @see L3ProtocolDataBuilder + * + */ +public interface L3ProtocolData + extends + ChildOf, + Augmentable +{ + + + public enum IpVersion implements Enumeration { + Ipv4(0, "ipv4"), + + Ipv6(1, "ipv6") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (IpVersion enumItem : IpVersion.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private IpVersion(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding IpVersion item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding IpVersion item, or null if no such item exists + */ + public static IpVersion forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public enum Ipv6AddressMode implements Enumeration { + Slaac(0, "slaac"), + + Dhcpv6Stateful(1, "dhcpv6-stateful"), + + Dhcpv6Stateless(2, "dhcpv6-stateless") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (Ipv6AddressMode enumItem : Ipv6AddressMode.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private Ipv6AddressMode(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding Ipv6AddressMode item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding Ipv6AddressMode item, or null if no such item exists + */ + public static Ipv6AddressMode forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("l3-protocol-data"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data.L3ProtocolData.class; + } + + /** + * Network name associated with this L3 protocol. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Specifies IP version of this L3 protocol. Value: • IPV4. • IPV6. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data.L3ProtocolData.IpVersion ipVersion, or null if not present + */ + @Nullable IpVersion getIpVersion(); + + /** + * Specifies the CIDR (Classless InterDomain Routing) of this L3 protocol. + * + * + * + * @return java.lang.String cidr, or null if not present + */ + @Nullable String getCidr(); + + /** + * Specifies the allocation pools with start and end IP addresses for this L3 + * protocol. + * + * + * + * @return java.util.List ipAllocationPools, or null if not present + */ + @Nullable List getIpAllocationPools(); + + /** + * Specifies the gateway IP address for this L3 protocol. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress gatewayIp, or null if not present + */ + @Nullable IpAddress getGatewayIp(); + + /** + * Indicates whether DHCP (Dynamic Host Configuration Protocol) is enabled or + * disabled for this L3 protocol. + * + * + * + * @return java.lang.Boolean dhcpEnabled, or null if not present + */ + @Nullable Boolean isDhcpEnabled(); + + /** + * Specifies IPv6 address mode. Possible values: • SLAAC. • DHCPV6-STATEFUL. • + * DHCPV6-STATELESS. May be present when the value of the ipVersion attribute is + * 'IPV6' and shall be absent otherwise. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data.L3ProtocolData.Ipv6AddressMode ipv6AddressMode, or null if not present + */ + @Nullable Ipv6AddressMode getIpv6AddressMode(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L3ProtocolDataBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L3ProtocolDataBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..e9af8c6f455b17b5bf3050ca8acb884c43190100 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/ip/profiles/norev/extended/vld/protocol/data/virtual/link/protocol/data/L3ProtocolDataBuilder.java @@ -0,0 +1,368 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.ip.profiles.norev.extended.vld.protocol.data.virtual.link.protocol.data; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link L3ProtocolDataBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     L3ProtocolDataBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new L3ProtocolDataBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of L3ProtocolDataBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see L3ProtocolDataBuilder + * @see Builder + * + */ +public class L3ProtocolDataBuilder implements Builder { + + private String _cidr; + private IpAddress _gatewayIp; + private List _ipAllocationPools; + private L3ProtocolData.IpVersion _ipVersion; + private L3ProtocolData.Ipv6AddressMode _ipv6AddressMode; + private String _name; + private Boolean _dhcpEnabled; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public L3ProtocolDataBuilder() { + } + + public L3ProtocolDataBuilder(L3ProtocolData base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._cidr = base.getCidr(); + this._gatewayIp = base.getGatewayIp(); + this._ipAllocationPools = base.getIpAllocationPools(); + this._ipVersion = base.getIpVersion(); + this._ipv6AddressMode = base.getIpv6AddressMode(); + this._name = base.getName(); + this._dhcpEnabled = base.isDhcpEnabled(); + } + + + public String getCidr() { + return _cidr; + } + + public IpAddress getGatewayIp() { + return _gatewayIp; + } + + public List getIpAllocationPools() { + return _ipAllocationPools; + } + + public L3ProtocolData.IpVersion getIpVersion() { + return _ipVersion; + } + + public L3ProtocolData.Ipv6AddressMode getIpv6AddressMode() { + return _ipv6AddressMode; + } + + public String getName() { + return _name; + } + + public Boolean isDhcpEnabled() { + return _dhcpEnabled; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public L3ProtocolDataBuilder setCidr(final String value) { + this._cidr = value; + return this; + } + + public L3ProtocolDataBuilder setGatewayIp(final IpAddress value) { + this._gatewayIp = value; + return this; + } + public L3ProtocolDataBuilder setIpAllocationPools(final List values) { + this._ipAllocationPools = values; + return this; + } + + + public L3ProtocolDataBuilder setIpVersion(final L3ProtocolData.IpVersion value) { + this._ipVersion = value; + return this; + } + + public L3ProtocolDataBuilder setIpv6AddressMode(final L3ProtocolData.Ipv6AddressMode value) { + this._ipv6AddressMode = value; + return this; + } + + public L3ProtocolDataBuilder setName(final String value) { + this._name = value; + return this; + } + + public L3ProtocolDataBuilder setDhcpEnabled(final Boolean value) { + this._dhcpEnabled = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public L3ProtocolDataBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public L3ProtocolDataBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public L3ProtocolDataBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private L3ProtocolDataBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public L3ProtocolData build() { + return new L3ProtocolDataImpl(this); + } + + private static final class L3ProtocolDataImpl + extends AbstractAugmentable + implements L3ProtocolData { + + private final String _cidr; + private final IpAddress _gatewayIp; + private final List _ipAllocationPools; + private final L3ProtocolData.IpVersion _ipVersion; + private final L3ProtocolData.Ipv6AddressMode _ipv6AddressMode; + private final String _name; + private final Boolean _dhcpEnabled; + + L3ProtocolDataImpl(L3ProtocolDataBuilder base) { + super(base.augmentation); + this._cidr = base.getCidr(); + this._gatewayIp = base.getGatewayIp(); + this._ipAllocationPools = base.getIpAllocationPools(); + this._ipVersion = base.getIpVersion(); + this._ipv6AddressMode = base.getIpv6AddressMode(); + this._name = base.getName(); + this._dhcpEnabled = base.isDhcpEnabled(); + } + + @Override + public String getCidr() { + return _cidr; + } + + @Override + public IpAddress getGatewayIp() { + return _gatewayIp; + } + + @Override + public List getIpAllocationPools() { + return _ipAllocationPools; + } + + @Override + public L3ProtocolData.IpVersion getIpVersion() { + return _ipVersion; + } + + @Override + public L3ProtocolData.Ipv6AddressMode getIpv6AddressMode() { + return _ipv6AddressMode; + } + + @Override + public String getName() { + return _name; + } + + @Override + public Boolean isDhcpEnabled() { + return _dhcpEnabled; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cidr); + result = prime * result + Objects.hashCode(_gatewayIp); + result = prime * result + Objects.hashCode(_ipAllocationPools); + result = prime * result + Objects.hashCode(_ipVersion); + result = prime * result + Objects.hashCode(_ipv6AddressMode); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_dhcpEnabled); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!L3ProtocolData.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + L3ProtocolData other = (L3ProtocolData)obj; + if (!Objects.equals(_cidr, other.getCidr())) { + return false; + } + if (!Objects.equals(_gatewayIp, other.getGatewayIp())) { + return false; + } + if (!Objects.equals(_ipAllocationPools, other.getIpAllocationPools())) { + return false; + } + if (!Objects.equals(_ipVersion, other.getIpVersion())) { + return false; + } + if (!Objects.equals(_ipv6AddressMode, other.getIpv6AddressMode())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_dhcpEnabled, other.isDhcpEnabled())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + L3ProtocolDataImpl otherImpl = (L3ProtocolDataImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("L3ProtocolData"); + CodeHelpers.appendValue(helper, "_cidr", _cidr); + CodeHelpers.appendValue(helper, "_gatewayIp", _gatewayIp); + CodeHelpers.appendValue(helper, "_ipAllocationPools", _ipAllocationPools); + CodeHelpers.appendValue(helper, "_ipVersion", _ipVersion); + CodeHelpers.appendValue(helper, "_ipv6AddressMode", _ipv6AddressMode); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_dhcpEnabled", _dhcpEnabled); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..9fcfa57713b3833fc1a22a812263bbda9ea61087 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..12c33849ea121c0bbcd66636eb192cc3b28cad59 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/$YangModuleInfoImpl.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:osm:yang:augments:kdu", "kdu").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/kdu.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/ExtendedExtCpd.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/ExtendedExtCpd.java new file mode 100644 index 0000000000000000000000000000000000000000..570b36253caf5b6a2a167fd9efb80884810ff2bb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/ExtendedExtCpd.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module kdu + *

+ * grouping extended-ext-cpd {
+ *   leaf k8s-cluster-net {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * kdu/extended-ext-cpd + * + */ +public interface ExtendedExtCpd + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-ext-cpd"); + + @Override + Class implementedInterface(); + + /** + * Reference to the K8s cluster network to which CPs instantiated from this + * external CP Descriptor (CPD) connect. + * + * + * + * @return java.lang.String k8sClusterNet, or null if not present + */ + @Nullable String getK8sClusterNet(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/ExtendedKdu.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/ExtendedKdu.java new file mode 100644 index 0000000000000000000000000000000000000000..84e293e6b17edee35dc4999c115ddfffe5d87a04 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/ExtendedKdu.java @@ -0,0 +1,138 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.K8sCluster; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.Kdu; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.KduKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.Service; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.ServiceKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module kdu + *

+ * grouping extended-kdu {
+ *   list kdu {
+ *     key name;
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf description {
+ *       type string;
+ *     }
+ *     choice kdu-model {
+ *       case helm-chart {
+ *         leaf helm-chart {
+ *           type string;
+ *         }
+ *         leaf helm-version {
+ *           type enumeration {
+ *             enum v2;
+ *             enum v3;
+ *           }
+ *           default v3;
+ *         }
+ *       }
+ *       case juju-bundle {
+ *         leaf juju-bundle {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   container k8s-cluster {
+ *     leaf-list version {
+ *       type string;
+ *     }
+ *     leaf-list cni {
+ *       type enumeration {
+ *         enum calico;
+ *         enum flannel;
+ *         enum multus;
+ *       }
+ *     }
+ *     list nets {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   list service {
+ *     key name;
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf mgmt-service {
+ *       type boolean;
+ *       default false;
+ *     }
+ *     leaf external-connection-point-ref {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * kdu/extended-kdu + * + */ +public interface ExtendedKdu + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-kdu"); + + @Override + Class implementedInterface(); + + /** + * List of K8s Deployment Units + * + * + * + * @return java.util.Map kdu, or null if not present + */ + @Nullable Map getKdu(); + + /** + * @return java.util.Map kdu, or an empty list if it is not present + */ + default @NonNull Map nonnullKdu() { + return CodeHelpers.nonnull(getKdu()); + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.K8sCluster k8sCluster, or null if not present + */ + @Nullable K8sCluster getK8sCluster(); + + /** + * List of Kubernetes services exposed by the KDU. If empty, all services are + * assumed to be exposed in the CP associated to the first network in + * k8s-cluster.nets. + * + * + * + * @return java.util.Map service, or null if not present + */ + @Nullable Map getService(); + + /** + * @return java.util.Map service, or an empty list if it is not present + */ + default @NonNull Map nonnullService() { + return CodeHelpers.nonnull(getService()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/Vnfd1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/Vnfd1.java new file mode 100644 index 0000000000000000000000000000000000000000..0e4ea541ec5988347a8fb1c18ec808c5012097a7 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/Vnfd1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.Vnfd; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface Vnfd1 + extends + Augmentation, + ExtendedKdu +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.Vnfd1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/Vnfd1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/Vnfd1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..6e19a50fa669fef8563f102520f9ee7ac700edfc --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/Vnfd1Builder.java @@ -0,0 +1,249 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev; +import com.google.common.base.MoreObjects; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.K8sCluster; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.Kdu; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.KduKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.Service; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.ServiceKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link Vnfd1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     Vnfd1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new Vnfd1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of Vnfd1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see Vnfd1Builder + * @see Builder + * + */ +public class Vnfd1Builder implements Builder { + + private K8sCluster _k8sCluster; + private Map _kdu; + private Map _service; + + + + public Vnfd1Builder() { + } + public Vnfd1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.ExtendedKdu arg) { + this._kdu = arg.getKdu(); + this._k8sCluster = arg.getK8sCluster(); + this._service = arg.getService(); + } + + public Vnfd1Builder(Vnfd1 base) { + this._k8sCluster = base.getK8sCluster(); + this._kdu = base.getKdu(); + this._service = base.getService(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.ExtendedKdu
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.ExtendedKdu) { + this._kdu = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.ExtendedKdu)arg).getKdu(); + this._k8sCluster = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.ExtendedKdu)arg).getK8sCluster(); + this._service = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.ExtendedKdu)arg).getService(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.ExtendedKdu]"); + } + + public K8sCluster getK8sCluster() { + return _k8sCluster; + } + + public Map getKdu() { + return _kdu; + } + + public Map getService() { + return _service; + } + + + public Vnfd1Builder setK8sCluster(final K8sCluster value) { + this._k8sCluster = value; + return this; + } + public Vnfd1Builder setKdu(final Map values) { + this._kdu = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setKdu(Map)} instead. + */ + @Deprecated(forRemoval = true) + public Vnfd1Builder setKdu(final List values) { + return setKdu(CodeHelpers.compatMap(values)); + } + public Vnfd1Builder setService(final Map values) { + this._service = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setService(Map)} instead. + */ + @Deprecated(forRemoval = true) + public Vnfd1Builder setService(final List values) { + return setService(CodeHelpers.compatMap(values)); + } + + + @Override + public Vnfd1 build() { + return new Vnfd1Impl(this); + } + + private static final class Vnfd1Impl + implements Vnfd1 { + + private final K8sCluster _k8sCluster; + private final Map _kdu; + private final Map _service; + + Vnfd1Impl(Vnfd1Builder base) { + this._k8sCluster = base.getK8sCluster(); + this._kdu = CodeHelpers.emptyToNull(base.getKdu()); + this._service = CodeHelpers.emptyToNull(base.getService()); + } + + @Override + public K8sCluster getK8sCluster() { + return _k8sCluster; + } + + @Override + public Map getKdu() { + return _kdu; + } + + @Override + public Map getService() { + return _service; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_k8sCluster); + result = prime * result + Objects.hashCode(_kdu); + result = prime * result + Objects.hashCode(_service); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vnfd1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vnfd1 other = (Vnfd1)obj; + if (!Objects.equals(_k8sCluster, other.getK8sCluster())) { + return false; + } + if (!Objects.equals(_kdu, other.getKdu())) { + return false; + } + if (!Objects.equals(_service, other.getService())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vnfd1"); + CodeHelpers.appendValue(helper, "_k8sCluster", _k8sCluster); + CodeHelpers.appendValue(helper, "_kdu", _kdu); + CodeHelpers.appendValue(helper, "_service", _service); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/K8sCluster.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/K8sCluster.java new file mode 100644 index 0000000000000000000000000000000000000000..b9bf5bf8b1a907db228d61a59fd513482ac4a2ed --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/K8sCluster.java @@ -0,0 +1,169 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.ExtendedKdu; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.k8s.cluster.Nets; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.k8s.cluster.NetsKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module kdu + *

+ * container k8s-cluster {
+ *   leaf-list version {
+ *     type string;
+ *   }
+ *   leaf-list cni {
+ *     type enumeration {
+ *       enum calico;
+ *       enum flannel;
+ *       enum multus;
+ *     }
+ *   }
+ *   list nets {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * kdu/extended-kdu/k8s-cluster + * + *

To create instances of this class use {@link K8sClusterBuilder}. + * @see K8sClusterBuilder + * + */ +public interface K8sCluster + extends + ChildOf, + Augmentable +{ + + + public enum Cni implements Enumeration { + Calico(0, "calico"), + + Flannel(1, "flannel"), + + Multus(2, "multus") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (Cni enumItem : Cni.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private Cni(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding Cni item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding Cni item, or null if no such item exists + */ + public static Cni forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("k8s-cluster"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.K8sCluster.class; + } + + /** + * List of supported K8s versions. The cluster where the KDUs will be deployed will + * have to match one of these versions. + * + * + * + * @return java.util.List version, or null if not present + */ + @Nullable List getVersion(); + + /** + * List of supported CNI plugins. The cluster where the KDUs will be deployed will + * have to use one of these CNI plugins. + * + * + * + * @return java.util.List cni, or null if not present + */ + @Nullable List getCni(); + + /** + * List of required networks in the K8s cluster. The cluster where the KDUs will be + * deployed will have to use one of these CNI plugins. + * + * + * + * @return java.util.Map nets, or null if not present + */ + @Nullable Map getNets(); + + /** + * @return java.util.Map nets, or an empty list if it is not present + */ + default @NonNull Map nonnullNets() { + return CodeHelpers.nonnull(getNets()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/K8sClusterBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/K8sClusterBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..034f0b78482e57768f7eb5e24e4b93e71e442c53 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/K8sClusterBuilder.java @@ -0,0 +1,293 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.k8s.cluster.Nets; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.k8s.cluster.NetsKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link K8sClusterBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     K8sClusterBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new K8sClusterBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of K8sClusterBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see K8sClusterBuilder + * @see Builder + * + */ +public class K8sClusterBuilder implements Builder { + + private List _cni; + private Map _nets; + private List _version; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public K8sClusterBuilder() { + } + + public K8sClusterBuilder(K8sCluster base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._cni = base.getCni(); + this._nets = base.getNets(); + this._version = base.getVersion(); + } + + + public List getCni() { + return _cni; + } + + public Map getNets() { + return _nets; + } + + public List getVersion() { + return _version; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public K8sClusterBuilder setCni(final List values) { + this._cni = values; + return this; + } + + public K8sClusterBuilder setNets(final Map values) { + this._nets = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setNets(Map)} instead. + */ + @Deprecated(forRemoval = true) + public K8sClusterBuilder setNets(final List values) { + return setNets(CodeHelpers.compatMap(values)); + } + public K8sClusterBuilder setVersion(final List values) { + this._version = values; + return this; + } + + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public K8sClusterBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public K8sClusterBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public K8sClusterBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private K8sClusterBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public K8sCluster build() { + return new K8sClusterImpl(this); + } + + private static final class K8sClusterImpl + extends AbstractAugmentable + implements K8sCluster { + + private final List _cni; + private final Map _nets; + private final List _version; + + K8sClusterImpl(K8sClusterBuilder base) { + super(base.augmentation); + this._cni = base.getCni(); + this._nets = CodeHelpers.emptyToNull(base.getNets()); + this._version = base.getVersion(); + } + + @Override + public List getCni() { + return _cni; + } + + @Override + public Map getNets() { + return _nets; + } + + @Override + public List getVersion() { + return _version; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_cni); + result = prime * result + Objects.hashCode(_nets); + result = prime * result + Objects.hashCode(_version); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!K8sCluster.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + K8sCluster other = (K8sCluster)obj; + if (!Objects.equals(_cni, other.getCni())) { + return false; + } + if (!Objects.equals(_nets, other.getNets())) { + return false; + } + if (!Objects.equals(_version, other.getVersion())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + K8sClusterImpl otherImpl = (K8sClusterImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("K8sCluster"); + CodeHelpers.appendValue(helper, "_cni", _cni); + CodeHelpers.appendValue(helper, "_nets", _nets); + CodeHelpers.appendValue(helper, "_version", _version); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/Kdu.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/Kdu.java new file mode 100644 index 0000000000000000000000000000000000000000..3055e8f26e5b5e9c8d4e45b065a0ba1715e7e6bc --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/Kdu.java @@ -0,0 +1,104 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.ExtendedKdu; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.KduModel; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * List of K8s Deployment Units + * + *

+ * This class represents the following YANG schema fragment defined in module kdu + *

+ * list kdu {
+ *   key name;
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   choice kdu-model {
+ *     case helm-chart {
+ *       leaf helm-chart {
+ *         type string;
+ *       }
+ *       leaf helm-version {
+ *         type enumeration {
+ *           enum v2;
+ *           enum v3;
+ *         }
+ *         default v3;
+ *       }
+ *     }
+ *     case juju-bundle {
+ *       leaf juju-bundle {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * kdu/extended-kdu/kdu + * + *

To create instances of this class use {@link KduBuilder}. + * @see KduBuilder + * @see KduKey + * + */ +public interface Kdu + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("kdu"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.Kdu.class; + } + + /** + * Unique name for the KDU + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Description of the KDU. + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * Indicates the KDU model, either as a helm-chart or as a juju-bundle. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.KduModel kduModel, or null if not present + */ + @Nullable KduModel getKduModel(); + + @Override + KduKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/KduBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/KduBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..79534936769d734e17b404585dfbb0dedb70728f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/KduBuilder.java @@ -0,0 +1,295 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.KduModel; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link KduBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     KduBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new KduBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of KduBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see KduBuilder + * @see Builder + * + */ +public class KduBuilder implements Builder { + + private String _description; + private KduModel _kduModel; + private String _name; + private KduKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public KduBuilder() { + } + + public KduBuilder(Kdu base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._name = base.getName(); + this._description = base.getDescription(); + this._kduModel = base.getKduModel(); + } + + + public KduKey key() { + return key; + } + + public String getDescription() { + return _description; + } + + public KduModel getKduModel() { + return _kduModel; + } + + public String getName() { + return _name; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public KduBuilder withKey(final KduKey key) { + this.key = key; + return this; + } + + public KduBuilder setDescription(final String value) { + this._description = value; + return this; + } + + public KduBuilder setKduModel(final KduModel value) { + this._kduModel = value; + return this; + } + + public KduBuilder setName(final String value) { + this._name = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public KduBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public KduBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public KduBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private KduBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Kdu build() { + return new KduImpl(this); + } + + private static final class KduImpl + extends AbstractAugmentable + implements Kdu { + + private final String _description; + private final KduModel _kduModel; + private final String _name; + private final KduKey key; + + KduImpl(KduBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new KduKey(base.getName()); + } + this._name = key.getName(); + this._description = base.getDescription(); + this._kduModel = base.getKduModel(); + } + + @Override + public KduKey key() { + return key; + } + + @Override + public String getDescription() { + return _description; + } + + @Override + public KduModel getKduModel() { + return _kduModel; + } + + @Override + public String getName() { + return _name; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_description); + result = prime * result + Objects.hashCode(_kduModel); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Kdu.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Kdu other = (Kdu)obj; + if (!Objects.equals(_description, other.getDescription())) { + return false; + } + if (!Objects.equals(_kduModel, other.getKduModel())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + KduImpl otherImpl = (KduImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Kdu"); + CodeHelpers.appendValue(helper, "_description", _description); + CodeHelpers.appendValue(helper, "_kduModel", _kduModel); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/KduKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/KduKey.java new file mode 100644 index 0000000000000000000000000000000000000000..50f6e1e7787048fe3b8a4d85a93979895b98505d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/KduKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class KduKey + implements Identifier { + private static final long serialVersionUID = -1781471998111978536L; + private final String _name; + + + public KduKey(String _name) { + + this._name = _name; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public KduKey(KduKey source) { + this._name = source._name; + } + + + public String getName() { + return _name; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_name); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof KduKey)) { + return false; + } + final KduKey other = (KduKey) obj; + if (!Objects.equals(_name, other._name)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(KduKey.class); + CodeHelpers.appendValue(helper, "_name", _name); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/Service.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/Service.java new file mode 100644 index 0000000000000000000000000000000000000000..67ed2da53eb63040395792c7ce1b6f0dabfb7b72 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/Service.java @@ -0,0 +1,96 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.ExtendedKdu; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * List of Kubernetes services exposed by the KDU. If empty, all services are + * assumed to be exposed in the CP associated to the first network in + * k8s-cluster.nets. + * + *

+ * This class represents the following YANG schema fragment defined in module kdu + *

+ * list service {
+ *   key name;
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf mgmt-service {
+ *     type boolean;
+ *     default false;
+ *   }
+ *   leaf external-connection-point-ref {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * kdu/extended-kdu/service + * + *

To create instances of this class use {@link ServiceBuilder}. + * @see ServiceBuilder + * @see ServiceKey + * + */ +public interface Service + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("service"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.Service.class; + } + + /** + * Name of the Kubernetes service exposed by he KDU model + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Flag to indicate that this Kubernetes service is a mgmt service to be used for + * KDU configuration. Defaults to false (if no present). All services with + * mgmt-service set to true will be passed to the execution environment in charge + * of the KDU configuration. + * + * + * + * @return java.lang.Boolean mgmtService, or null if not present + */ + @Nullable Boolean isMgmtService(); + + /** + * String representing a leaf reference to the particular external connection + * point. This field should match + * /etsi-nfv-vnfd:vnfd/etsi-nfv-vnfd:ext-cpd/etsi-nfv-vnfd:id + * + * + * + * @return java.lang.String externalConnectionPointRef, or null if not present + */ + @Nullable String getExternalConnectionPointRef(); + + @Override + ServiceKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/ServiceBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/ServiceBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..09646a1672a534ebd827abf2ea1268071c35a894 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/ServiceBuilder.java @@ -0,0 +1,295 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu; +import com.google.common.base.MoreObjects; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ServiceBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ServiceBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ServiceBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ServiceBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ServiceBuilder + * @see Builder + * + */ +public class ServiceBuilder implements Builder { + + private String _externalConnectionPointRef; + private String _name; + private Boolean _mgmtService; + private ServiceKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ServiceBuilder() { + } + + public ServiceBuilder(Service base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._name = base.getName(); + this._externalConnectionPointRef = base.getExternalConnectionPointRef(); + this._mgmtService = base.isMgmtService(); + } + + + public ServiceKey key() { + return key; + } + + public String getExternalConnectionPointRef() { + return _externalConnectionPointRef; + } + + public String getName() { + return _name; + } + + public Boolean isMgmtService() { + return _mgmtService; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ServiceBuilder withKey(final ServiceKey key) { + this.key = key; + return this; + } + + public ServiceBuilder setExternalConnectionPointRef(final String value) { + this._externalConnectionPointRef = value; + return this; + } + + public ServiceBuilder setName(final String value) { + this._name = value; + return this; + } + + public ServiceBuilder setMgmtService(final Boolean value) { + this._mgmtService = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ServiceBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ServiceBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ServiceBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ServiceBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Service build() { + return new ServiceImpl(this); + } + + private static final class ServiceImpl + extends AbstractAugmentable + implements Service { + + private final String _externalConnectionPointRef; + private final String _name; + private final Boolean _mgmtService; + private final ServiceKey key; + + ServiceImpl(ServiceBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new ServiceKey(base.getName()); + } + this._name = key.getName(); + this._externalConnectionPointRef = base.getExternalConnectionPointRef(); + this._mgmtService = base.isMgmtService(); + } + + @Override + public ServiceKey key() { + return key; + } + + @Override + public String getExternalConnectionPointRef() { + return _externalConnectionPointRef; + } + + @Override + public String getName() { + return _name; + } + + @Override + public Boolean isMgmtService() { + return _mgmtService; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_externalConnectionPointRef); + result = prime * result + Objects.hashCode(_name); + result = prime * result + Objects.hashCode(_mgmtService); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Service.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Service other = (Service)obj; + if (!Objects.equals(_externalConnectionPointRef, other.getExternalConnectionPointRef())) { + return false; + } + if (!Objects.equals(_name, other.getName())) { + return false; + } + if (!Objects.equals(_mgmtService, other.isMgmtService())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ServiceImpl otherImpl = (ServiceImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Service"); + CodeHelpers.appendValue(helper, "_externalConnectionPointRef", _externalConnectionPointRef); + CodeHelpers.appendValue(helper, "_name", _name); + CodeHelpers.appendValue(helper, "_mgmtService", _mgmtService); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/ServiceKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/ServiceKey.java new file mode 100644 index 0000000000000000000000000000000000000000..e32f3c440cb5bd95a21ce2025becb39c3e38fa49 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/ServiceKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class ServiceKey + implements Identifier { + private static final long serialVersionUID = 6159412498490091992L; + private final String _name; + + + public ServiceKey(String _name) { + + this._name = _name; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public ServiceKey(ServiceKey source) { + this._name = source._name; + } + + + public String getName() { + return _name; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_name); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ServiceKey)) { + return false; + } + final ServiceKey other = (ServiceKey) obj; + if (!Objects.equals(_name, other._name)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(ServiceKey.class); + CodeHelpers.appendValue(helper, "_name", _name); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/k8s/cluster/Nets.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/k8s/cluster/Nets.java new file mode 100644 index 0000000000000000000000000000000000000000..27bf85497d9c66de3121fbf8af10eee907b0085b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/k8s/cluster/Nets.java @@ -0,0 +1,64 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.k8s.cluster; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.K8sCluster; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * List of required networks in the K8s cluster. The cluster where the KDUs will + * deployed will have to use one of these CNI plugins. + * + *

+ * This class represents the following YANG schema fragment defined in module kdu + *

+ * list nets {
+ *   key id;
+ *   leaf id {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * kdu/extended-kdu/k8s-cluster/nets + * + *

To create instances of this class use {@link NetsBuilder}. + * @see NetsBuilder + * @see NetsKey + * + */ +public interface Nets + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("nets"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.k8s.cluster.Nets.class; + } + + /** + * Internal identifier for the K8s cluster network in this VNF + * + * + * + * @return java.lang.String id, or null if not present + */ + @Nullable String getId(); + + @Override + NetsKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/k8s/cluster/NetsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/k8s/cluster/NetsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..b3e67c8dc2a3ee0d01614ae4c6240bbe601669e3 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/k8s/cluster/NetsBuilder.java @@ -0,0 +1,248 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.k8s.cluster; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link NetsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     NetsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new NetsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of NetsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see NetsBuilder + * @see Builder + * + */ +public class NetsBuilder implements Builder { + + private String _id; + private NetsKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public NetsBuilder() { + } + + public NetsBuilder(Nets base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._id = base.getId(); + } + + + public NetsKey key() { + return key; + } + + public String getId() { + return _id; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public NetsBuilder withKey(final NetsKey key) { + this.key = key; + return this; + } + + public NetsBuilder setId(final String value) { + this._id = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public NetsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public NetsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public NetsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private NetsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Nets build() { + return new NetsImpl(this); + } + + private static final class NetsImpl + extends AbstractAugmentable + implements Nets { + + private final String _id; + private final NetsKey key; + + NetsImpl(NetsBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new NetsKey(base.getId()); + } + this._id = key.getId(); + } + + @Override + public NetsKey key() { + return key; + } + + @Override + public String getId() { + return _id; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_id); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Nets.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Nets other = (Nets)obj; + if (!Objects.equals(_id, other.getId())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + NetsImpl otherImpl = (NetsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Nets"); + CodeHelpers.appendValue(helper, "_id", _id); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/k8s/cluster/NetsKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/k8s/cluster/NetsKey.java new file mode 100644 index 0000000000000000000000000000000000000000..779f2b0fe4483f7f03c1e2976bcfa63633420f6b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/k8s/cluster/NetsKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.k8s.cluster; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class NetsKey + implements Identifier { + private static final long serialVersionUID = -8522176258253854917L; + private final String _id; + + + public NetsKey(String _id) { + + this._id = _id; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public NetsKey(NetsKey source) { + this._id = source._id; + } + + + public String getId() { + return _id; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_id); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof NetsKey)) { + return false; + } + final NetsKey other = (NetsKey) obj; + if (!Objects.equals(_id, other._id)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(NetsKey.class); + CodeHelpers.appendValue(helper, "_id", _id); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/KduModel.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/KduModel.java new file mode 100644 index 0000000000000000000000000000000000000000..a5ea155ae55127f34e1ebbae0ca306ed5b4843ce --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/KduModel.java @@ -0,0 +1,48 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.Kdu; +import org.opendaylight.yangtools.yang.binding.ChoiceIn; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Indicates the KDU model, either as a helm-chart or as a juju-bundle. + * + *

+ * This class represents the following YANG schema fragment defined in module kdu + *

+ * choice kdu-model {
+ *   case helm-chart {
+ *     leaf helm-chart {
+ *       type string;
+ *     }
+ *     leaf helm-version {
+ *       type enumeration {
+ *         enum v2;
+ *         enum v3;
+ *       }
+ *       default v3;
+ *     }
+ *   }
+ *   case juju-bundle {
+ *     leaf juju-bundle {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * kdu/extended-kdu/kdu/kdu-model + * + */ +public interface KduModel + extends + ChoiceIn +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("kdu-model"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/HelmChart.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/HelmChart.java new file mode 100644 index 0000000000000000000000000000000000000000..934444818fd4f8a417a6de6d713f0cd0746b5724 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/HelmChart.java @@ -0,0 +1,140 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.kdu.model; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Class; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.KduModel; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module kdu + *

+ * case helm-chart {
+ *   leaf helm-chart {
+ *     type string;
+ *   }
+ *   leaf helm-version {
+ *     type enumeration {
+ *       enum v2;
+ *       enum v3;
+ *     }
+ *     default v3;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * kdu/extended-kdu/kdu/kdu-model/helm-chart + * + */ +public interface HelmChart + extends + DataObject, + Augmentable, + KduModel +{ + + + public enum HelmVersion implements Enumeration { + V2(0, "v2"), + + V3(1, "v3") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (HelmVersion enumItem : HelmVersion.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private HelmVersion(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding HelmVersion item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding HelmVersion item, or null if no such item exists + */ + public static HelmVersion forValue(int intValue) { + return VALUE_MAP.get(intValue); + } + } + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("helm-chart"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.kdu.model.HelmChart.class; + } + + /** + * Helm chart that models the KDU, in any of the following ways: - + * &lt;helm-repo&gt;/&lt;helm-chart&gt; - &lt;helm-chart folder + * under k8s_models folder in the package&gt; - &lt;helm-chart tgz file (w/ + * or w/o extension) under k8s_models folder in the package&gt; - + * &lt;URL_where_to_fetch_chart&gt; + * + * + * + * @return java.lang.String helmChart, or null if not present + */ + @Nullable String getHelmChart(); + + /** + * Helm version to use for this helm-chart, v3 by default + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.kdu.model.HelmChart.HelmVersion helmVersion, or null if not present + */ + @Nullable HelmVersion getHelmVersion(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/HelmChartBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/HelmChartBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..176e6bd53cff5cb0f5f7767297f90bd18992d004 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/HelmChartBuilder.java @@ -0,0 +1,250 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.kdu.model; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link HelmChartBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     HelmChartBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new HelmChartBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of HelmChartBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see HelmChartBuilder + * @see Builder + * + */ +public class HelmChartBuilder implements Builder { + + private String _helmChart; + private HelmChart.HelmVersion _helmVersion; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public HelmChartBuilder() { + } + + public HelmChartBuilder(HelmChart base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._helmChart = base.getHelmChart(); + this._helmVersion = base.getHelmVersion(); + } + + + public String getHelmChart() { + return _helmChart; + } + + public HelmChart.HelmVersion getHelmVersion() { + return _helmVersion; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public HelmChartBuilder setHelmChart(final String value) { + this._helmChart = value; + return this; + } + + public HelmChartBuilder setHelmVersion(final HelmChart.HelmVersion value) { + this._helmVersion = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public HelmChartBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public HelmChartBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public HelmChartBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private HelmChartBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public HelmChart build() { + return new HelmChartImpl(this); + } + + private static final class HelmChartImpl + extends AbstractAugmentable + implements HelmChart { + + private final String _helmChart; + private final HelmChart.HelmVersion _helmVersion; + + HelmChartImpl(HelmChartBuilder base) { + super(base.augmentation); + this._helmChart = base.getHelmChart(); + this._helmVersion = base.getHelmVersion(); + } + + @Override + public String getHelmChart() { + return _helmChart; + } + + @Override + public HelmChart.HelmVersion getHelmVersion() { + return _helmVersion; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_helmChart); + result = prime * result + Objects.hashCode(_helmVersion); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!HelmChart.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + HelmChart other = (HelmChart)obj; + if (!Objects.equals(_helmChart, other.getHelmChart())) { + return false; + } + if (!Objects.equals(_helmVersion, other.getHelmVersion())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + HelmChartImpl otherImpl = (HelmChartImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("HelmChart"); + CodeHelpers.appendValue(helper, "_helmChart", _helmChart); + CodeHelpers.appendValue(helper, "_helmVersion", _helmVersion); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/JujuBundle.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/JujuBundle.java new file mode 100644 index 0000000000000000000000000000000000000000..eff65c580228d7263e03708f03ad06c55bfadeb8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/JujuBundle.java @@ -0,0 +1,57 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.kdu.model; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.KduModel; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module kdu + *

+ * case juju-bundle {
+ *   leaf juju-bundle {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * kdu/extended-kdu/kdu/kdu-model/juju-bundle + * + */ +public interface JujuBundle + extends + DataObject, + Augmentable, + KduModel +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("juju-bundle"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.kdu.model.JujuBundle.class; + } + + /** + * Juju bundle that models the KDU, in any of the following ways: - + * &lt;juju-repo&gt;/&lt;juju-bundle&gt; - &lt;juju-bundle + * folder under k8s_models folder in the package&gt; - &lt;juju-bundle tgz + * file (w/ or w/o extension) under k8s_models folder in the package&gt; - + * &lt;URL_where_to_fetch_juju_bundle&gt; + * + * + * + * @return java.lang.String jujuBundle, or null if not present + */ + @Nullable String getJujuBundle(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/JujuBundleBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/JujuBundleBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..0671a600ecef79ac9ee3547e1bee4aa99cfe728d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/kdu/norev/extended/kdu/kdu/kdu/model/JujuBundleBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.kdu.norev.extended.kdu.kdu.kdu.model; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link JujuBundleBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     JujuBundleBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new JujuBundleBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of JujuBundleBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see JujuBundleBuilder + * @see Builder + * + */ +public class JujuBundleBuilder implements Builder { + + private String _jujuBundle; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public JujuBundleBuilder() { + } + + public JujuBundleBuilder(JujuBundle base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._jujuBundle = base.getJujuBundle(); + } + + + public String getJujuBundle() { + return _jujuBundle; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public JujuBundleBuilder setJujuBundle(final String value) { + this._jujuBundle = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public JujuBundleBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public JujuBundleBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public JujuBundleBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private JujuBundleBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public JujuBundle build() { + return new JujuBundleImpl(this); + } + + private static final class JujuBundleImpl + extends AbstractAugmentable + implements JujuBundle { + + private final String _jujuBundle; + + JujuBundleImpl(JujuBundleBuilder base) { + super(base.augmentation); + this._jujuBundle = base.getJujuBundle(); + } + + @Override + public String getJujuBundle() { + return _jujuBundle; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_jujuBundle); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!JujuBundle.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + JujuBundle other = (JujuBundle)obj; + if (!Objects.equals(_jujuBundle, other.getJujuBundle())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + JujuBundleImpl otherImpl = (JujuBundleImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("JujuBundle"); + CodeHelpers.appendValue(helper, "_jujuBundle", _jujuBundle); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..c599724f6293cad507a22cb1fb030045ed69d29d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.mgmt._interface.norev; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fc294a8732292454bb35929c5b085acd7032b40c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/$YangModuleInfoImpl.java @@ -0,0 +1,47 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.mgmt._interface.norev; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:osm:yang:augments:mgmt-interface", "mgmt-interface").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + Set set = new HashSet<>(); + set.add(org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.$YangModuleInfoImpl.getInstance()); + importedModules = ImmutableSet.copyOf(set); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/mgmt-interface.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/ExtendedMgmtInterface.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/ExtendedMgmtInterface.java new file mode 100644 index 0000000000000000000000000000000000000000..0dec721445f51ec9fe7e3a3dc9c441406c87df3f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/ExtendedMgmtInterface.java @@ -0,0 +1,48 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.mgmt._interface.norev; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module mgmt-interface + *

+ * grouping extended-mgmt-interface {
+ *   leaf mgmt-cp {
+ *     type leafref {
+ *       path /vnfd:vnfd/vnfd:ext-cpd/vnfd:id;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * mgmt-interface/extended-mgmt-interface + * + */ +public interface ExtendedMgmtInterface + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("extended-mgmt-interface"); + + @Override + Class implementedInterface(); + + /** + * Connection point over which the VNF is managed. + * + * + * + * @return java.lang.String mgmtCp, or null if not present + */ + @Nullable String getMgmtCp(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/Vnfd1.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/Vnfd1.java new file mode 100644 index 0000000000000000000000000000000000000000..edbb9baef0819a5faabcba4316e109610a9a69ec --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/Vnfd1.java @@ -0,0 +1,22 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.mgmt._interface.norev; +import java.lang.Class; +import java.lang.Override; +import org.opendaylight.yang.gen.v1.urn.etsi.nfv.yang.etsi.nfv.vnfd.rev190318.Vnfd; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public interface Vnfd1 + extends + Augmentation, + ExtendedMgmtInterface +{ + + + + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.mgmt._interface.norev.Vnfd1.class; + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/Vnfd1Builder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/Vnfd1Builder.java new file mode 100644 index 0000000000000000000000000000000000000000..d320fbf1b93befb67419a928a455804a146461eb --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/mgmt/_interface/norev/Vnfd1Builder.java @@ -0,0 +1,157 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.mgmt._interface.norev; +import com.google.common.base.MoreObjects; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link Vnfd1Builder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     Vnfd1Builder createTarget(int fooXyzzy, int barBaz) {
+ *         return new Vnfd1BuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of Vnfd1Builder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see Vnfd1Builder + * @see Builder + * + */ +public class Vnfd1Builder implements Builder { + + private String _mgmtCp; + + + + public Vnfd1Builder() { + } + public Vnfd1Builder(org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.mgmt._interface.norev.ExtendedMgmtInterface arg) { + this._mgmtCp = arg.getMgmtCp(); + } + + public Vnfd1Builder(Vnfd1 base) { + this._mgmtCp = base.getMgmtCp(); + } + + /** + * Set fields from given grouping argument. Valid argument is instance of one of following types: + *
    + *
  • org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.mgmt._interface.norev.ExtendedMgmtInterface
  • + *
+ * + * @param arg grouping object + * @throws IllegalArgumentException if given argument is none of valid types + */ + public void fieldsFrom(DataObject arg) { + boolean isValidArg = false; + if (arg instanceof org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.mgmt._interface.norev.ExtendedMgmtInterface) { + this._mgmtCp = ((org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.mgmt._interface.norev.ExtendedMgmtInterface)arg).getMgmtCp(); + isValidArg = true; + } + CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.mgmt._interface.norev.ExtendedMgmtInterface]"); + } + + public String getMgmtCp() { + return _mgmtCp; + } + + + public Vnfd1Builder setMgmtCp(final String value) { + this._mgmtCp = value; + return this; + } + + + @Override + public Vnfd1 build() { + return new Vnfd1Impl(this); + } + + private static final class Vnfd1Impl + implements Vnfd1 { + + private final String _mgmtCp; + + Vnfd1Impl(Vnfd1Builder base) { + this._mgmtCp = base.getMgmtCp(); + } + + @Override + public String getMgmtCp() { + return _mgmtCp; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_mgmtCp); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Vnfd1.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Vnfd1 other = (Vnfd1)obj; + if (!Objects.equals(_mgmtCp, other.getMgmtCp())) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Vnfd1"); + CodeHelpers.appendValue(helper, "_mgmtCp", _mgmtCp); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/$YangModelBindingProvider.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/$YangModelBindingProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..5e94ccf735c440ef00018450151a960533618fc8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/$YangModelBindingProvider.java @@ -0,0 +1,12 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; + +import java.lang.Override; +import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; + +public final class $YangModelBindingProvider implements YangModelBindingProvider { + @Override + public YangModuleInfo getModuleInfo() { + return $YangModuleInfoImpl.getInstance(); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/$YangModuleInfoImpl.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/$YangModuleInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..659fbf0a0a8e81edaee349bfe9676ef324207061 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/$YangModuleInfoImpl.java @@ -0,0 +1,43 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; + +import com.google.common.collect.ImmutableSet; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.ResourceYangModuleInfo; +import org.opendaylight.yangtools.yang.binding.YangModuleInfo; +import org.opendaylight.yangtools.yang.common.QName; + +public final class $YangModuleInfoImpl extends ResourceYangModuleInfo { + private static final @NonNull QName NAME = QName.create("urn:etsi:osm:yang:augments", "common-augments").intern(); + private static final @NonNull YangModuleInfo INSTANCE = new $YangModuleInfoImpl(); + + private final @NonNull ImmutableSet importedModules; + + public static @NonNull YangModuleInfo getInstance() { + return INSTANCE; + } + + public static @NonNull QName qnameOf(final String localName) { + return QName.create(NAME, localName).intern(); + } + + private $YangModuleInfoImpl() { + importedModules = ImmutableSet.of(); + } + + @Override + public QName getName() { + return NAME; + } + + @Override + protected String resourceName() { + return "/META-INF/yang/common-augments.yang"; + } + + @Override + public ImmutableSet getImportedModules() { + return importedModules; + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/AlarmProperties.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/AlarmProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..31ed08058930ba866e935c5c035ec84cdd199417 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/AlarmProperties.java @@ -0,0 +1,204 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import java.math.BigDecimal; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.Actions; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint32; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * grouping alarm-properties {
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf description {
+ *     type string;
+ *   }
+ *   leaf vdur-id {
+ *     type string;
+ *   }
+ *   container actions {
+ *     list ok {
+ *       key url;
+ *       leaf url {
+ *         type string;
+ *       }
+ *     }
+ *     list insufficient-data {
+ *       key url;
+ *       leaf url {
+ *         type string;
+ *       }
+ *     }
+ *     list alarm {
+ *       key url;
+ *       leaf url {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ *   leaf repeat {
+ *     type boolean;
+ *     default true;
+ *   }
+ *   leaf enabled {
+ *     type boolean;
+ *     default true;
+ *   }
+ *   leaf severity {
+ *     type alarm-severity-type;
+ *   }
+ *   leaf statistic {
+ *     type alarm-statistic-type;
+ *   }
+ *   leaf operation {
+ *     type relational-operation-type;
+ *   }
+ *   leaf value {
+ *     type decimal64 {
+ *       fraction-digits 4;
+ *     }
+ *   }
+ *   leaf period {
+ *     type uint32;
+ *   }
+ *   leaf evaluations {
+ *     type uint32;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/alarm-properties + * + */ +public interface AlarmProperties + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("alarm-properties"); + + @Override + Class implementedInterface(); + + /** + * A human readable string to identify the alarm + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * A description of this alarm + * + * + * + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + + /** + * The identifier of the VDUR that the alarm is associated with + * + * + * + * @return java.lang.String vdurId, or null if not present + */ + @Nullable String getVdurId(); + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.Actions actions, or null if not present + */ + @Nullable Actions getActions(); + + /** + * This flag indicates whether the alarm should be repeatedly emitted while the + * associated threshold has been crossed. + * + * + * + * @return java.lang.Boolean repeat, or null if not present + */ + @Nullable Boolean isRepeat(); + + /** + * This flag indicates whether the alarm has been enabled or disabled. + * + * + * + * @return java.lang.Boolean enabled, or null if not present + */ + @Nullable Boolean isEnabled(); + + /** + * A measure of the importance or urgency of the alarm + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmSeverityType severity, or null if not present + */ + @Nullable AlarmSeverityType getSeverity(); + + /** + * The type of metric statistic that is tracked by this alarm + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmStatisticType statistic, or null if not present + */ + @Nullable AlarmStatisticType getStatistic(); + + /** + * The relational operator used to define whether an alarm should be triggered in + * certain scenarios, such as if the metric statistic goes above or below a + * specified value. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.RelationalOperationType operation, or null if not present + */ + @Nullable RelationalOperationType getOperation(); + + /** + * This value defines the threshold that, if crossed, will trigger the alarm. + * + * + * + * @return java.math.BigDecimal value, or null if not present + */ + @Nullable BigDecimal getValue(); + + /** + * The period defines the length of time (seconds) that the metric data are + * collected over in oreder to evaluate the chosen statistic. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 period, or null if not present + */ + @Nullable Uint32 getPeriod(); + + /** + * Defines the length of time (seconds) in which metric data are collected in order + * to evaluate the chosen statistic. + * + * + * + * @return org.opendaylight.yangtools.yang.common.Uint32 evaluations, or null if not present + */ + @Nullable Uint32 getEvaluations(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/AlarmSeverityType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/AlarmSeverityType.java new file mode 100644 index 0000000000000000000000000000000000000000..302676e6ef410660c703f19be3c013847ace1fda --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/AlarmSeverityType.java @@ -0,0 +1,73 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.opendaylight.yangtools.yang.binding.Enumeration; + +public enum AlarmSeverityType implements Enumeration { + LOW(0, "LOW"), + + MODERATE(1, "MODERATE"), + + CRITICAL(2, "CRITICAL") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (AlarmSeverityType enumItem : AlarmSeverityType.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private AlarmSeverityType(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding AlarmSeverityType item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding AlarmSeverityType item, or null if no such item exists + */ + public static AlarmSeverityType forValue(int intValue) { + return VALUE_MAP.get(intValue); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/AlarmStatisticType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/AlarmStatisticType.java new file mode 100644 index 0000000000000000000000000000000000000000..e0742bdf6c46e8ff0f7247ae91d381c245d1a0c0 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/AlarmStatisticType.java @@ -0,0 +1,77 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.opendaylight.yangtools.yang.binding.Enumeration; + +public enum AlarmStatisticType implements Enumeration { + AVERAGE(0, "AVERAGE"), + + MINIMUM(1, "MINIMUM"), + + MAXIMUM(2, "MAXIMUM"), + + COUNT(3, "COUNT"), + + SUM(4, "SUM") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (AlarmStatisticType enumItem : AlarmStatisticType.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private AlarmStatisticType(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding AlarmStatisticType item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding AlarmStatisticType item, or null if no such item exists + */ + public static AlarmStatisticType forValue(int intValue) { + return VALUE_MAP.get(intValue); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ConfigurationMethod.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ConfigurationMethod.java new file mode 100644 index 0000000000000000000000000000000000000000..6dfc91b567601095a87b167d6a3f14fb8946100e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ConfigurationMethod.java @@ -0,0 +1,118 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.ConfigMethod; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * grouping configuration-method {
+ *   choice config-method {
+ *     case script {
+ *       container script {
+ *         leaf script-type {
+ *           type enumeration {
+ *             enum rift;
+ *           }
+ *         }
+ *       }
+ *     }
+ *     case juju {
+ *       container juju {
+ *         leaf charm {
+ *           type string;
+ *         }
+ *         leaf proxy {
+ *           type boolean;
+ *           default true;
+ *         }
+ *         leaf cloud {
+ *           type enumeration {
+ *             enum lxd;
+ *             enum k8s;
+ *           }
+ *           default lxd;
+ *         }
+ *       }
+ *     }
+ *     case execution-environment-list {
+ *       list execution-environment-list {
+ *         key id;
+ *         leaf id {
+ *           type string;
+ *         }
+ *         choice execution-environment-model {
+ *           case juju {
+ *             container juju {
+ *               leaf charm {
+ *                 type string;
+ *               }
+ *               leaf proxy {
+ *                 type boolean;
+ *                 default true;
+ *               }
+ *               leaf cloud {
+ *                 type enumeration {
+ *                   enum lxd;
+ *                   enum k8s;
+ *                 }
+ *                 default lxd;
+ *               }
+ *             }
+ *           }
+ *           case helm-chart {
+ *             leaf helm-chart {
+ *               type string;
+ *             }
+ *             leaf helm-version {
+ *               type enumeration {
+ *                 enum v2;
+ *                 enum v3;
+ *               }
+ *               default v3;
+ *             }
+ *           }
+ *         }
+ *         leaf metric-service {
+ *           type string;
+ *         }
+ *         leaf external-connection-point-ref {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/configuration-method + * + */ +public interface ConfigurationMethod + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("configuration-method"); + + @Override + Class implementedInterface(); + + /** + * Defines the configuration method for the VNF or VDU. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.ConfigMethod configMethod, or null if not present + */ + @Nullable ConfigMethod getConfigMethod(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/Description.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/Description.java new file mode 100644 index 0000000000000000000000000000000000000000..2d9df33fbb37f116db4343dcdbdb97f7911f80ed --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/Description.java @@ -0,0 +1,42 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * grouping description {
+ *   leaf description {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/description + * + */ +public interface Description + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("description"); + + @Override + Class implementedInterface(); + + /** + * @return java.lang.String description, or null if not present + */ + @Nullable String getDescription(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ParameterDataType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ParameterDataType.java new file mode 100644 index 0000000000000000000000000000000000000000..3eaa70752297965508a2f2051c3dfd3338eab58a --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ParameterDataType.java @@ -0,0 +1,73 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.opendaylight.yangtools.yang.binding.Enumeration; + +public enum ParameterDataType implements Enumeration { + STRING(0, "STRING"), + + INTEGER(1, "INTEGER"), + + BOOLEAN(2, "BOOLEAN") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (ParameterDataType enumItem : ParameterDataType.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private ParameterDataType(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding ParameterDataType item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding ParameterDataType item, or null if no such item exists + */ + public static ParameterDataType forValue(int intValue) { + return VALUE_MAP.get(intValue); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/PrimitiveParameter.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/PrimitiveParameter.java new file mode 100644 index 0000000000000000000000000000000000000000..014a54f09a33b4c7c4f93301a5c298ebc2a2bc07 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/PrimitiveParameter.java @@ -0,0 +1,124 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import java.lang.Boolean; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * grouping primitive-parameter {
+ *   leaf name {
+ *     type string;
+ *   }
+ *   leaf data-type {
+ *     type common:parameter-data-type;
+ *   }
+ *   leaf mandatory {
+ *     type boolean;
+ *     default false;
+ *   }
+ *   leaf default-value {
+ *     type string;
+ *   }
+ *   leaf parameter-pool {
+ *     type string;
+ *   }
+ *   leaf read-only {
+ *     type boolean;
+ *     default false;
+ *   }
+ *   leaf hidden {
+ *     type boolean;
+ *     default false;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/primitive-parameter + * + */ +public interface PrimitiveParameter + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("primitive-parameter"); + + @Override + Class implementedInterface(); + + /** + * Name of the parameter. + * + * + * + * @return java.lang.String name, or null if not present + */ + @Nullable String getName(); + + /** + * Data type associated with the name. + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.ParameterDataType dataType, or null if not present + */ + @Nullable ParameterDataType getDataType(); + + /** + * Is this field mandatory + * + * + * + * @return java.lang.Boolean mandatory, or null if not present + */ + @Nullable Boolean isMandatory(); + + /** + * The default value for this field + * + * + * + * @return java.lang.String defaultValue, or null if not present + */ + @Nullable String getDefaultValue(); + + /** + * NSD parameter pool name to use for this parameter + * + * + * + * @return java.lang.String parameterPool, or null if not present + */ + @Nullable String getParameterPool(); + + /** + * The value should be dimmed by the UI. Only applies to parameters with default + * values. + * + * + * + * @return java.lang.Boolean readOnly, or null if not present + */ + @Nullable Boolean isReadOnly(); + + /** + * The value should be hidden by the UI. Only applies to parameters with default + * values. + * + * + * + * @return java.lang.Boolean hidden, or null if not present + */ + @Nullable Boolean isHidden(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/PrimitiveParameterValue.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/PrimitiveParameterValue.java new file mode 100644 index 0000000000000000000000000000000000000000..5ab3e9b9c36d8c26b72de7e2c888909cc9d77b92 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/PrimitiveParameterValue.java @@ -0,0 +1,65 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.primitive.parameter.value.Parameter; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.primitive.parameter.value.ParameterKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * grouping primitive-parameter-value {
+ *   list parameter {
+ *     key name;
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf data-type {
+ *       type common:parameter-data-type;
+ *     }
+ *     leaf value {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/primitive-parameter-value + * + */ +public interface PrimitiveParameterValue + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("primitive-parameter-value"); + + @Override + Class implementedInterface(); + + /** + * List of parameters to the configuration primitive. + * + * + * + * @return java.util.Map parameter, or null if not present + */ + @Nullable Map getParameter(); + + /** + * @return java.util.Map parameter, or an empty list if it is not present + */ + default @NonNull Map nonnullParameter() { + return CodeHelpers.nonnull(getParameter()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/RelationalOperationType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/RelationalOperationType.java new file mode 100644 index 0000000000000000000000000000000000000000..da1bee75f0bc7925da5a460cbbab400622dbd826 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/RelationalOperationType.java @@ -0,0 +1,77 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.opendaylight.yangtools.yang.binding.Enumeration; + +public enum RelationalOperationType implements Enumeration { + GE(0, "GE"), + + LE(1, "LE"), + + GT(2, "GT"), + + LT(3, "LT"), + + EQ(4, "EQ") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (RelationalOperationType enumItem : RelationalOperationType.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private RelationalOperationType(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding RelationalOperationType item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding RelationalOperationType item, or null if no such item exists + */ + public static RelationalOperationType forValue(int intValue) { + return VALUE_MAP.get(intValue); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ScalingCriteriaOperation.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ScalingCriteriaOperation.java new file mode 100644 index 0000000000000000000000000000000000000000..ee357f7851089fafed8b4e3fccf63edcedce490f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ScalingCriteriaOperation.java @@ -0,0 +1,71 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.opendaylight.yangtools.yang.binding.Enumeration; + +public enum ScalingCriteriaOperation implements Enumeration { + AND(1, "AND"), + + OR(2, "OR") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (ScalingCriteriaOperation enumItem : ScalingCriteriaOperation.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private ScalingCriteriaOperation(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding ScalingCriteriaOperation item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding ScalingCriteriaOperation item, or null if no such item exists + */ + public static ScalingCriteriaOperation forValue(int intValue) { + return VALUE_MAP.get(intValue); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ScalingPolicyType.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ScalingPolicyType.java new file mode 100644 index 0000000000000000000000000000000000000000..6e8c1c61367c46065da65ff63f7a2ec678d9003d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ScalingPolicyType.java @@ -0,0 +1,71 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.opendaylight.yangtools.yang.binding.Enumeration; + +public enum ScalingPolicyType implements Enumeration { + Manual(1, "manual"), + + Automatic(2, "automatic") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (ScalingPolicyType enumItem : ScalingPolicyType.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private ScalingPolicyType(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding ScalingPolicyType item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding ScalingPolicyType item, or null if no such item exists + */ + public static ScalingPolicyType forValue(int intValue) { + return VALUE_MAP.get(intValue); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ScalingTrigger.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ScalingTrigger.java new file mode 100644 index 0000000000000000000000000000000000000000..b6519978fb82e7c205e6c2c93834d3a401222e40 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/ScalingTrigger.java @@ -0,0 +1,75 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.opendaylight.yangtools.yang.binding.Enumeration; + +public enum ScalingTrigger implements Enumeration { + PreScaleIn(1, "pre-scale-in"), + + PostScaleIn(2, "post-scale-in"), + + PreScaleOut(3, "pre-scale-out"), + + PostScaleOut(4, "post-scale-out") + ; + + private static final Map NAME_MAP; + private static final Map VALUE_MAP; + + static { + final Builder nb = ImmutableMap.builder(); + final Builder vb = ImmutableMap.builder(); + for (ScalingTrigger enumItem : ScalingTrigger.values()) { + vb.put(enumItem.value, enumItem); + nb.put(enumItem.name, enumItem); + } + + NAME_MAP = nb.build(); + VALUE_MAP = vb.build(); + } + + private final String name; + private final int value; + + private ScalingTrigger(int value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public int getIntValue() { + return value; + } + + /** + * Return the enumeration member whose {@link #getName()} matches specified value. + * + * @param name YANG assigned name + * @return corresponding ScalingTrigger item, if present + * @throws NullPointerException if name is null + */ + public static Optional forName(String name) { + return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name))); + } + + /** + * Return the enumeration member whose {@link #getIntValue()} matches specified value. + * + * @param intValue integer value + * @return corresponding ScalingTrigger item, or null if no such item exists + */ + public static ScalingTrigger forValue(int intValue) { + return VALUE_MAP.get(intValue); + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VduConfigAccess.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VduConfigAccess.java new file mode 100644 index 0000000000000000000000000000000000000000..d86abcd8f4f4d91874f24728856c4a492d1aa5d1 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VduConfigAccess.java @@ -0,0 +1,55 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vdu.config.access.ConfigAccess; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * grouping vdu-config-access {
+ *   container config-access {
+ *     container ssh-access {
+ *       leaf required {
+ *         type boolean;
+ *         default false;
+ *       }
+ *       leaf default-user {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/vdu-config-access + * + */ +public interface VduConfigAccess + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vdu-config-access"); + + @Override + Class implementedInterface(); + + /** + * Indicates the way to access to the xNF or xDU for VCA configuration. For the + * moment there is a single way (ssh-access). + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vdu.config.access.ConfigAccess configAccess, or null if not present + */ + @Nullable ConfigAccess getConfigAccess(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VirtualInterface.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VirtualInterface.java new file mode 100644 index 0000000000000000000000000000000000000000..8c8854b4e7ef13747cdcc58131b672d68e4ec239 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VirtualInterface.java @@ -0,0 +1,63 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * grouping virtual-interface {
+ *   container virtual-interface {
+ *     leaf type {
+ *       type enumeration {
+ *         enum PARAVIRT;
+ *         enum OM-MGMT;
+ *         enum PCI-PASSTHROUGH;
+ *         enum SR-IOV;
+ *         enum VIRTIO;
+ *         enum E1000;
+ *         enum RTL8139;
+ *         enum PCNET;
+ *       }
+ *       default PARAVIRT;
+ *     }
+ *     leaf vpci {
+ *       type string;
+ *     }
+ *     leaf bandwidth {
+ *       type uint64;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/virtual-interface + * + */ +public interface VirtualInterface + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("virtual-interface"); + + @Override + Class implementedInterface(); + + /** + * Container for the virtual interface properties + * + * + * + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.virtual._interface.VirtualInterface virtualInterface, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.virtual._interface.@Nullable VirtualInterface getVirtualInterface(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VnfcConfiguration.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VnfcConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..9140159bbf5e113367668fcb7b069b738f16eb87 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VnfcConfiguration.java @@ -0,0 +1,158 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.ConfigPrimitive; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.ConfigPrimitiveKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.InitialConfigPrimitive; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.InitialConfigPrimitiveKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.TerminateConfigPrimitive; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.configuration.TerminateConfigPrimitiveKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Common information in the descriptors for NS, VNF or VDU configuration. Note: + * the NS contains multiple instances of the same VNF or VDU, each instance could + * have a different configuration. + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * grouping vnfc-configuration {
+ *   uses common:configuration-method;
+ *   list config-primitive {
+ *     key name;
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf execution-environment-ref {
+ *       type leafref {
+ *         path ../../execution-environment-list/id;
+ *       }
+ *     }
+ *     leaf execution-environment-primitive {
+ *       type string;
+ *     }
+ *     list parameter {
+ *       key name;
+ *       uses primitive-parameter;
+ *     }
+ *     leaf user-defined-script {
+ *       type string;
+ *     }
+ *   }
+ *   list initial-config-primitive {
+ *     key seq;
+ *     leaf seq {
+ *       type uint64;
+ *     }
+ *     choice primitive-type {
+ *       case primitive-definition {
+ *         leaf name {
+ *           type string;
+ *         }
+ *         leaf execution-environment-ref {
+ *           type leafref {
+ *             path ../../execution-environment-list/id;
+ *           }
+ *         }
+ *         uses primitive-parameter-value;
+ *         leaf user-defined-script {
+ *           type string;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   list terminate-config-primitive {
+ *     key seq;
+ *     leaf seq {
+ *       type uint64;
+ *     }
+ *     leaf name {
+ *       type string;
+ *     }
+ *     leaf execution-environment-ref {
+ *       type leafref {
+ *         path ../../execution-environment-list/id;
+ *       }
+ *     }
+ *     uses primitive-parameter-value;
+ *     leaf user-defined-script {
+ *       type string;
+ *     }
+ *   }
+ *   uses common:vnfc-metrics;
+ * }
+ * 
The schema path to identify an instance is + * common-augments/vnfc-configuration + * + */ +public interface VnfcConfiguration + extends + DataObject, + ConfigurationMethod, + VnfcMetrics +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnfc-configuration"); + + @Override + Class implementedInterface(); + + /** + * List of config primitives supported by the configuration agent for this VNF or + * VDU. + * + * + * + * @return java.util.Map configPrimitive, or null if not present + */ + @Nullable Map getConfigPrimitive(); + + /** + * @return java.util.Map configPrimitive, or an empty list if it is not present + */ + default @NonNull Map nonnullConfigPrimitive() { + return CodeHelpers.nonnull(getConfigPrimitive()); + } + + /** + * Initial set of configuration primitives. + * + * + * + * @return java.util.Map initialConfigPrimitive, or null if not present + */ + @Nullable Map getInitialConfigPrimitive(); + + /** + * @return java.util.Map initialConfigPrimitive, or an empty list if it is not present + */ + default @NonNull Map nonnullInitialConfigPrimitive() { + return CodeHelpers.nonnull(getInitialConfigPrimitive()); + } + + /** + * Terminate set of configuration primitives. + * + * + * + * @return java.util.Map terminateConfigPrimitive, or null if not present + */ + @Nullable Map getTerminateConfigPrimitive(); + + /** + * @return java.util.Map terminateConfigPrimitive, or an empty list if it is not present + */ + default @NonNull Map nonnullTerminateConfigPrimitive() { + return CodeHelpers.nonnull(getTerminateConfigPrimitive()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VnfcMetrics.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VnfcMetrics.java new file mode 100644 index 0000000000000000000000000000000000000000..d00f2da7ffa7d7ced7c2446e70ea0c6e41ca837c --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VnfcMetrics.java @@ -0,0 +1,60 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.metrics.Metrics; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.metrics.MetricsKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Information about the VNF or VDU metrics + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * grouping vnfc-metrics {
+ *   list metrics {
+ *     key name;
+ *     leaf name {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/vnfc-metrics + * + */ +public interface VnfcMetrics + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnfc-metrics"); + + @Override + Class implementedInterface(); + + /** + * List of VNFC related metrics + * + * + * + * @return java.util.Map metrics, or null if not present + */ + @Nullable Map getMetrics(); + + /** + * @return java.util.Map metrics, or an empty list if it is not present + */ + default @NonNull Map nonnullMetrics() { + return CodeHelpers.nonnull(getMetrics()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VnfcRelations.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VnfcRelations.java new file mode 100644 index 0000000000000000000000000000000000000000..be6f861caf66ec9644364ba675c08a7109d21d8b --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/VnfcRelations.java @@ -0,0 +1,68 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.relations.Relation; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.vnfc.relations.RelationKey; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * grouping vnfc-relations {
+ *   list relation {
+ *     key name;
+ *     leaf name {
+ *       type string;
+ *     }
+ *     list entities {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       leaf endpoint {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/vnfc-relations + * + */ +public interface VnfcRelations + extends + DataObject +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("vnfc-relations"); + + @Override + Class implementedInterface(); + + /** + * List of relations between elements in this descriptor. + * + * + * + * @return java.util.Map relation, or null if not present + */ + @Nullable Map getRelation(); + + /** + * @return java.util.Map relation, or an empty list if it is not present + */ + default @NonNull Map nonnullRelation() { + return CodeHelpers.nonnull(getRelation()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/Actions.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/Actions.java new file mode 100644 index 0000000000000000000000000000000000000000..18e35ddf9a01924c3d9fcd1ccbf42557b53df258 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/Actions.java @@ -0,0 +1,104 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.AlarmProperties; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.Alarm; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.AlarmKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.InsufficientData; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.InsufficientDataKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.Ok; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.OkKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * container actions {
+ *   list ok {
+ *     key url;
+ *     leaf url {
+ *       type string;
+ *     }
+ *   }
+ *   list insufficient-data {
+ *     key url;
+ *     leaf url {
+ *       type string;
+ *     }
+ *   }
+ *   list alarm {
+ *     key url;
+ *     leaf url {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/alarm-properties/actions + * + *

To create instances of this class use {@link ActionsBuilder}. + * @see ActionsBuilder + * + */ +public interface Actions + extends + ChildOf, + Augmentable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("actions"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.Actions.class; + } + + /** + * @return java.util.Map ok, or null if not present + */ + @Nullable Map getOk(); + + /** + * @return java.util.Map ok, or an empty list if it is not present + */ + default @NonNull Map nonnullOk() { + return CodeHelpers.nonnull(getOk()); + } + + /** + * @return java.util.Map insufficientData, or null if not present + */ + @Nullable Map getInsufficientData(); + + /** + * @return java.util.Map insufficientData, or an empty list if it is not present + */ + default @NonNull Map nonnullInsufficientData() { + return CodeHelpers.nonnull(getInsufficientData()); + } + + /** + * @return java.util.Map alarm, or null if not present + */ + @Nullable Map getAlarm(); + + /** + * @return java.util.Map alarm, or an empty list if it is not present + */ + default @NonNull Map nonnullAlarm() { + return CodeHelpers.nonnull(getAlarm()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/ActionsBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/ActionsBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..5053a62423fcd63f12e86803e91674f76785bd49 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/ActionsBuilder.java @@ -0,0 +1,331 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.Alarm; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.AlarmKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.InsufficientData; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.InsufficientDataKey; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.Ok; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.OkKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ActionsBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ActionsBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ActionsBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ActionsBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ActionsBuilder + * @see Builder + * + */ +public class ActionsBuilder implements Builder { + + private Map _alarm; + private Map _insufficientData; + private Map _ok; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ActionsBuilder() { + } + + public ActionsBuilder(Actions base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._alarm = base.getAlarm(); + this._insufficientData = base.getInsufficientData(); + this._ok = base.getOk(); + } + + + public Map getAlarm() { + return _alarm; + } + + public Map getInsufficientData() { + return _insufficientData; + } + + public Map getOk() { + return _ok; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ActionsBuilder setAlarm(final Map values) { + this._alarm = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setAlarm(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ActionsBuilder setAlarm(final List values) { + return setAlarm(CodeHelpers.compatMap(values)); + } + public ActionsBuilder setInsufficientData(final Map values) { + this._insufficientData = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setInsufficientData(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ActionsBuilder setInsufficientData(final List values) { + return setInsufficientData(CodeHelpers.compatMap(values)); + } + public ActionsBuilder setOk(final Map values) { + this._ok = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setOk(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ActionsBuilder setOk(final List values) { + return setOk(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ActionsBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ActionsBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ActionsBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ActionsBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Actions build() { + return new ActionsImpl(this); + } + + private static final class ActionsImpl + extends AbstractAugmentable + implements Actions { + + private final Map _alarm; + private final Map _insufficientData; + private final Map _ok; + + ActionsImpl(ActionsBuilder base) { + super(base.augmentation); + this._alarm = CodeHelpers.emptyToNull(base.getAlarm()); + this._insufficientData = CodeHelpers.emptyToNull(base.getInsufficientData()); + this._ok = CodeHelpers.emptyToNull(base.getOk()); + } + + @Override + public Map getAlarm() { + return _alarm; + } + + @Override + public Map getInsufficientData() { + return _insufficientData; + } + + @Override + public Map getOk() { + return _ok; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_alarm); + result = prime * result + Objects.hashCode(_insufficientData); + result = prime * result + Objects.hashCode(_ok); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Actions.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Actions other = (Actions)obj; + if (!Objects.equals(_alarm, other.getAlarm())) { + return false; + } + if (!Objects.equals(_insufficientData, other.getInsufficientData())) { + return false; + } + if (!Objects.equals(_ok, other.getOk())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ActionsImpl otherImpl = (ActionsImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Actions"); + CodeHelpers.appendValue(helper, "_alarm", _alarm); + CodeHelpers.appendValue(helper, "_insufficientData", _insufficientData); + CodeHelpers.appendValue(helper, "_ok", _ok); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/Alarm.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/Alarm.java new file mode 100644 index 0000000000000000000000000000000000000000..be80e0062bb7f27d786af46525d1da1b49964fc8 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/Alarm.java @@ -0,0 +1,58 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.Actions; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * list alarm {
+ *   key url;
+ *   leaf url {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/alarm-properties/actions/alarm + * + *

To create instances of this class use {@link AlarmBuilder}. + * @see AlarmBuilder + * @see AlarmKey + * + */ +public interface Alarm + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("alarm"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.Alarm.class; + } + + /** + * @return java.lang.String url, or null if not present + */ + @Nullable String getUrl(); + + @Override + AlarmKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/AlarmBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/AlarmBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..f38c765618a4ab7f709ef4860c5700eb907a032d --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/AlarmBuilder.java @@ -0,0 +1,248 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link AlarmBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     AlarmBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new AlarmBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of AlarmBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see AlarmBuilder + * @see Builder + * + */ +public class AlarmBuilder implements Builder { + + private String _url; + private AlarmKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public AlarmBuilder() { + } + + public AlarmBuilder(Alarm base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._url = base.getUrl(); + } + + + public AlarmKey key() { + return key; + } + + public String getUrl() { + return _url; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public AlarmBuilder withKey(final AlarmKey key) { + this.key = key; + return this; + } + + public AlarmBuilder setUrl(final String value) { + this._url = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public AlarmBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public AlarmBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public AlarmBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private AlarmBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Alarm build() { + return new AlarmImpl(this); + } + + private static final class AlarmImpl + extends AbstractAugmentable + implements Alarm { + + private final String _url; + private final AlarmKey key; + + AlarmImpl(AlarmBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new AlarmKey(base.getUrl()); + } + this._url = key.getUrl(); + } + + @Override + public AlarmKey key() { + return key; + } + + @Override + public String getUrl() { + return _url; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_url); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Alarm.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Alarm other = (Alarm)obj; + if (!Objects.equals(_url, other.getUrl())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + AlarmImpl otherImpl = (AlarmImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Alarm"); + CodeHelpers.appendValue(helper, "_url", _url); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/AlarmKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/AlarmKey.java new file mode 100644 index 0000000000000000000000000000000000000000..ce636ce924f7ac39fc97f8db41ef47aabd37c477 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/AlarmKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class AlarmKey + implements Identifier { + private static final long serialVersionUID = 5352316849637502229L; + private final String _url; + + + public AlarmKey(String _url) { + + this._url = _url; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public AlarmKey(AlarmKey source) { + this._url = source._url; + } + + + public String getUrl() { + return _url; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_url); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof AlarmKey)) { + return false; + } + final AlarmKey other = (AlarmKey) obj; + if (!Objects.equals(_url, other._url)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(AlarmKey.class); + CodeHelpers.appendValue(helper, "_url", _url); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/InsufficientData.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/InsufficientData.java new file mode 100644 index 0000000000000000000000000000000000000000..505c08936a1b69c547aa50587b3b1449912da097 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/InsufficientData.java @@ -0,0 +1,58 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.Actions; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * list insufficient-data {
+ *   key url;
+ *   leaf url {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/alarm-properties/actions/insufficient-data + * + *

To create instances of this class use {@link InsufficientDataBuilder}. + * @see InsufficientDataBuilder + * @see InsufficientDataKey + * + */ +public interface InsufficientData + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("insufficient-data"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.InsufficientData.class; + } + + /** + * @return java.lang.String url, or null if not present + */ + @Nullable String getUrl(); + + @Override + InsufficientDataKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/InsufficientDataBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/InsufficientDataBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..4bb7d0d841c1a874ab3d78a4d0ddb29b7b958452 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/InsufficientDataBuilder.java @@ -0,0 +1,248 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link InsufficientDataBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     InsufficientDataBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new InsufficientDataBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of InsufficientDataBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see InsufficientDataBuilder + * @see Builder + * + */ +public class InsufficientDataBuilder implements Builder { + + private String _url; + private InsufficientDataKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public InsufficientDataBuilder() { + } + + public InsufficientDataBuilder(InsufficientData base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._url = base.getUrl(); + } + + + public InsufficientDataKey key() { + return key; + } + + public String getUrl() { + return _url; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public InsufficientDataBuilder withKey(final InsufficientDataKey key) { + this.key = key; + return this; + } + + public InsufficientDataBuilder setUrl(final String value) { + this._url = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public InsufficientDataBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public InsufficientDataBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public InsufficientDataBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private InsufficientDataBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public InsufficientData build() { + return new InsufficientDataImpl(this); + } + + private static final class InsufficientDataImpl + extends AbstractAugmentable + implements InsufficientData { + + private final String _url; + private final InsufficientDataKey key; + + InsufficientDataImpl(InsufficientDataBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new InsufficientDataKey(base.getUrl()); + } + this._url = key.getUrl(); + } + + @Override + public InsufficientDataKey key() { + return key; + } + + @Override + public String getUrl() { + return _url; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_url); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!InsufficientData.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + InsufficientData other = (InsufficientData)obj; + if (!Objects.equals(_url, other.getUrl())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + InsufficientDataImpl otherImpl = (InsufficientDataImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("InsufficientData"); + CodeHelpers.appendValue(helper, "_url", _url); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/InsufficientDataKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/InsufficientDataKey.java new file mode 100644 index 0000000000000000000000000000000000000000..a811b931ee44fe8e60eb01cb80015a651c1b67e1 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/InsufficientDataKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class InsufficientDataKey + implements Identifier { + private static final long serialVersionUID = -1701498022369005341L; + private final String _url; + + + public InsufficientDataKey(String _url) { + + this._url = _url; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public InsufficientDataKey(InsufficientDataKey source) { + this._url = source._url; + } + + + public String getUrl() { + return _url; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_url); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof InsufficientDataKey)) { + return false; + } + final InsufficientDataKey other = (InsufficientDataKey) obj; + if (!Objects.equals(_url, other._url)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(InsufficientDataKey.class); + CodeHelpers.appendValue(helper, "_url", _url); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/Ok.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/Ok.java new file mode 100644 index 0000000000000000000000000000000000000000..8c568756b85edb03a61a15a06d903f8194cf1da6 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/Ok.java @@ -0,0 +1,58 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions; +import java.lang.Class; +import java.lang.Override; +import java.lang.String; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.Actions; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.opendaylight.yangtools.yang.binding.Identifiable; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * list ok {
+ *   key url;
+ *   leaf url {
+ *     type string;
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/alarm-properties/actions/ok + * + *

To create instances of this class use {@link OkBuilder}. + * @see OkBuilder + * @see OkKey + * + */ +public interface Ok + extends + ChildOf, + Augmentable, + Identifiable +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("ok"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions.Ok.class; + } + + /** + * @return java.lang.String url, or null if not present + */ + @Nullable String getUrl(); + + @Override + OkKey key(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/OkBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/OkBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..78d35f4c538dc461818603b2483da1aa9bfef023 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/OkBuilder.java @@ -0,0 +1,248 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link OkBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     OkBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new OkBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of OkBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see OkBuilder + * @see Builder + * + */ +public class OkBuilder implements Builder { + + private String _url; + private OkKey key; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public OkBuilder() { + } + + public OkBuilder(Ok base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this.key = base.key(); + this._url = base.getUrl(); + } + + + public OkKey key() { + return key; + } + + public String getUrl() { + return _url; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public OkBuilder withKey(final OkKey key) { + this.key = key; + return this; + } + + public OkBuilder setUrl(final String value) { + this._url = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public OkBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public OkBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public OkBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private OkBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Ok build() { + return new OkImpl(this); + } + + private static final class OkImpl + extends AbstractAugmentable + implements Ok { + + private final String _url; + private final OkKey key; + + OkImpl(OkBuilder base) { + super(base.augmentation); + if (base.key() != null) { + this.key = base.key(); + } else { + this.key = new OkKey(base.getUrl()); + } + this._url = key.getUrl(); + } + + @Override + public OkKey key() { + return key; + } + + @Override + public String getUrl() { + return _url; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_url); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Ok.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Ok other = (Ok)obj; + if (!Objects.equals(_url, other.getUrl())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + OkImpl otherImpl = (OkImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Ok"); + CodeHelpers.appendValue(helper, "_url", _url); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/OkKey.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/OkKey.java new file mode 100644 index 0000000000000000000000000000000000000000..90949c31fa383e292271b73e3c2db92602ac257e --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/alarm/properties/actions/OkKey.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.alarm.properties.actions; +import com.google.common.base.MoreObjects; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.Identifier; + +public class OkKey + implements Identifier { + private static final long serialVersionUID = -3239917283088943717L; + private final String _url; + + + public OkKey(String _url) { + + this._url = _url; + } + + /** + * Creates a copy from Source Object. + * + * @param source Source object + */ + public OkKey(OkKey source) { + this._url = source._url; + } + + + public String getUrl() { + return _url; + } + + + @Override + public int hashCode() { + return CodeHelpers.wrapperHashCode(_url); + } + + @Override + public final boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof OkKey)) { + return false; + } + final OkKey other = (OkKey) obj; + if (!Objects.equals(_url, other._url)) { + return false; + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(OkKey.class); + CodeHelpers.appendValue(helper, "_url", _url); + return helper.toString(); + } +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/ConfigMethod.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/ConfigMethod.java new file mode 100644 index 0000000000000000000000000000000000000000..08e5973f375dbf51c2d9bad8cb23b2e0a8ed6f98 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/ConfigMethod.java @@ -0,0 +1,104 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.ConfigurationMethod; +import org.opendaylight.yangtools.yang.binding.ChoiceIn; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Defines the configuration method for the VNF or VDU. + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * choice config-method {
+ *   case script {
+ *     container script {
+ *       leaf script-type {
+ *         type enumeration {
+ *           enum rift;
+ *         }
+ *       }
+ *     }
+ *   }
+ *   case juju {
+ *     container juju {
+ *       leaf charm {
+ *         type string;
+ *       }
+ *       leaf proxy {
+ *         type boolean;
+ *         default true;
+ *       }
+ *       leaf cloud {
+ *         type enumeration {
+ *           enum lxd;
+ *           enum k8s;
+ *         }
+ *         default lxd;
+ *       }
+ *     }
+ *   }
+ *   case execution-environment-list {
+ *     list execution-environment-list {
+ *       key id;
+ *       leaf id {
+ *         type string;
+ *       }
+ *       choice execution-environment-model {
+ *         case juju {
+ *           container juju {
+ *             leaf charm {
+ *               type string;
+ *             }
+ *             leaf proxy {
+ *               type boolean;
+ *               default true;
+ *             }
+ *             leaf cloud {
+ *               type enumeration {
+ *                 enum lxd;
+ *                 enum k8s;
+ *               }
+ *               default lxd;
+ *             }
+ *           }
+ *         }
+ *         case helm-chart {
+ *           leaf helm-chart {
+ *             type string;
+ *           }
+ *           leaf helm-version {
+ *             type enumeration {
+ *               enum v2;
+ *               enum v3;
+ *             }
+ *             default v3;
+ *           }
+ *         }
+ *       }
+ *       leaf metric-service {
+ *         type string;
+ *       }
+ *       leaf external-connection-point-ref {
+ *         type string;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/configuration-method/config-method + * + */ +public interface ConfigMethod + extends + ChoiceIn +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("config-method"); + + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/ExecutionEnvironmentList.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/ExecutionEnvironmentList.java new file mode 100644 index 0000000000000000000000000000000000000000..34cc2101333a4a4431278494dd6c06d0d6c2d1bd --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/ExecutionEnvironmentList.java @@ -0,0 +1,100 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method; +import java.lang.Class; +import java.lang.Override; +import java.util.Map; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.ConfigMethod; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method.execution.environment.list.ExecutionEnvironmentListKey; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * List of Execution Environments to configure or monitor VNF or VDU. + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * case execution-environment-list {
+ *   list execution-environment-list {
+ *     key id;
+ *     leaf id {
+ *       type string;
+ *     }
+ *     choice execution-environment-model {
+ *       case juju {
+ *         container juju {
+ *           leaf charm {
+ *             type string;
+ *           }
+ *           leaf proxy {
+ *             type boolean;
+ *             default true;
+ *           }
+ *           leaf cloud {
+ *             type enumeration {
+ *               enum lxd;
+ *               enum k8s;
+ *             }
+ *             default lxd;
+ *           }
+ *         }
+ *       }
+ *       case helm-chart {
+ *         leaf helm-chart {
+ *           type string;
+ *         }
+ *         leaf helm-version {
+ *           type enumeration {
+ *             enum v2;
+ *             enum v3;
+ *           }
+ *           default v3;
+ *         }
+ *       }
+ *     }
+ *     leaf metric-service {
+ *       type string;
+ *     }
+ *     leaf external-connection-point-ref {
+ *       type string;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/configuration-method/config-method/execution-environment-list + * + */ +public interface ExecutionEnvironmentList + extends + DataObject, + Augmentable, + ConfigMethod +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("execution-environment-list"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method.ExecutionEnvironmentList.class; + } + + /** + * @return java.util.Map executionEnvironmentList, or null if not present + */ + @Nullable Map getExecutionEnvironmentList(); + + /** + * @return java.util.Map executionEnvironmentList, or an empty list if it is not present + */ + default @NonNull Map nonnullExecutionEnvironmentList() { + return CodeHelpers.nonnull(getExecutionEnvironmentList()); + } + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/ExecutionEnvironmentListBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/ExecutionEnvironmentListBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..bfc9294dd63b42a0bb18c9063a8bb58b5c8de45f --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/ExecutionEnvironmentListBuilder.java @@ -0,0 +1,246 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method.execution.environment.list.ExecutionEnvironmentListKey; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link ExecutionEnvironmentListBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     ExecutionEnvironmentListBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new ExecutionEnvironmentListBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of ExecutionEnvironmentListBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see ExecutionEnvironmentListBuilder + * @see Builder + * + */ +public class ExecutionEnvironmentListBuilder implements Builder { + + private Map _executionEnvironmentList; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public ExecutionEnvironmentListBuilder() { + } + + public ExecutionEnvironmentListBuilder(ExecutionEnvironmentList base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._executionEnvironmentList = base.getExecutionEnvironmentList(); + } + + + public Map getExecutionEnvironmentList() { + return _executionEnvironmentList; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + public ExecutionEnvironmentListBuilder setExecutionEnvironmentList(final Map values) { + this._executionEnvironmentList = values; + return this; + } + + /** + * Utility migration setter. + * + * IMPORTANT NOTE: This method does not completely match previous mechanics, as the list is processed as + * during this method's execution. Any future modifications of the list are NOT + * reflected in this builder nor its products. + * + * @param values Legacy List of values + * @return this builder + * @throws IllegalArgumentException if the list contains entries with the same key + * @throws NullPointerException if the list contains a null entry + * @deprecated Use {#link #setExecutionEnvironmentList(Map)} instead. + */ + @Deprecated(forRemoval = true) + public ExecutionEnvironmentListBuilder setExecutionEnvironmentList(final List values) { + return setExecutionEnvironmentList(CodeHelpers.compatMap(values)); + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public ExecutionEnvironmentListBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public ExecutionEnvironmentListBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public ExecutionEnvironmentListBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private ExecutionEnvironmentListBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public ExecutionEnvironmentList build() { + return new ExecutionEnvironmentListImpl(this); + } + + private static final class ExecutionEnvironmentListImpl + extends AbstractAugmentable + implements ExecutionEnvironmentList { + + private final Map _executionEnvironmentList; + + ExecutionEnvironmentListImpl(ExecutionEnvironmentListBuilder base) { + super(base.augmentation); + this._executionEnvironmentList = CodeHelpers.emptyToNull(base.getExecutionEnvironmentList()); + } + + @Override + public Map getExecutionEnvironmentList() { + return _executionEnvironmentList; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_executionEnvironmentList); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!ExecutionEnvironmentList.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + ExecutionEnvironmentList other = (ExecutionEnvironmentList)obj; + if (!Objects.equals(_executionEnvironmentList, other.getExecutionEnvironmentList())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + ExecutionEnvironmentListImpl otherImpl = (ExecutionEnvironmentListImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("ExecutionEnvironmentList"); + CodeHelpers.appendValue(helper, "_executionEnvironmentList", _executionEnvironmentList); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/Juju.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/Juju.java new file mode 100644 index 0000000000000000000000000000000000000000..0bb9e12c24282b908b310f43785bc4e3576b44ec --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/Juju.java @@ -0,0 +1,62 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.ConfigMethod; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Configure the VNF or VDU through Juju. + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * case juju {
+ *   container juju {
+ *     leaf charm {
+ *       type string;
+ *     }
+ *     leaf proxy {
+ *       type boolean;
+ *       default true;
+ *     }
+ *     leaf cloud {
+ *       type enumeration {
+ *         enum lxd;
+ *         enum k8s;
+ *       }
+ *       default lxd;
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/configuration-method/config-method/juju + * + */ +public interface Juju + extends + DataObject, + Augmentable, + ConfigMethod +{ + + + + public static final @NonNull QName QNAME = $YangModuleInfoImpl.qnameOf("juju"); + + @Override + default Class implementedInterface() { + return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method.Juju.class; + } + + /** + * @return org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method.juju.Juju juju, or null if not present + */ + org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method.juju.@Nullable Juju getJuju(); + +} + diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/JujuBuilder.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/JujuBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..834cac241fd0970396d09dfcf9e08ca2ac667147 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/JujuBuilder.java @@ -0,0 +1,227 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method; +import com.google.common.base.MoreObjects; +import java.lang.Class; +import java.lang.Deprecated; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.CodeHelpers; +import org.opendaylight.yangtools.yang.binding.DataObject; + +/** + * Class that builds {@link JujuBuilder} instances. Overall design of the class is that of a + * fluent interface, where method chaining is used. + * + *

+ * In general, this class is supposed to be used like this template: + *

+ *   
+ *     JujuBuilder createTarget(int fooXyzzy, int barBaz) {
+ *         return new JujuBuilderBuilder()
+ *             .setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
+ *             .setBar(new BarBuilder().setBaz(barBaz).build())
+ *             .build();
+ *     }
+ *   
+ * 
+ * + *

+ * This pattern is supported by the immutable nature of JujuBuilder, as instances can be freely passed around without + * worrying about synchronization issues. + * + *

+ * As a side note: method chaining results in: + *

    + *
  • very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is + * on the stack, so further method invocations just need to fill method arguments for the next method + * invocation, which is terminated by {@link #build()}, which is then returned from the method
  • + *
  • better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is + * very localized
  • + *
  • better optimization oportunities, as the object scope is minimized in terms of invocation (rather than + * method) stack, making escape analysis a lot + * easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely + * eliminated
  • + *
+ * + * @see JujuBuilder + * @see Builder + * + */ +public class JujuBuilder implements Builder { + + private org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method.juju.Juju _juju; + + + Map>, Augmentation> augmentation = Collections.emptyMap(); + + public JujuBuilder() { + } + + public JujuBuilder(Juju base) { + if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + Map>, Augmentation> aug =((AugmentationHolder) base).augmentations(); + if (!aug.isEmpty()) { + this.augmentation = new HashMap<>(aug); + } + } + this._juju = base.getJuju(); + } + + + public org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method.juju.Juju getJuju() { + return _juju; + } + + @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"}) + public > E$$ augmentation(Class augmentationType) { + return (E$$) augmentation.get(Objects.requireNonNull(augmentationType)); + } + + + public JujuBuilder setJuju(final org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method.juju.Juju value) { + this._juju = value; + return this; + } + + /** + * Add an augmentation to this builder's product. + * + * @param augmentation augmentation to be added + * @return this builder + * @throws NullPointerException if {@code augmentation} is null + */ + public JujuBuilder addAugmentation(Augmentation augmentation) { + return doAddAugmentation(augmentation.implementedInterface(), augmentation); + } + + /** + * Add or remove an augmentation to this builder's product. + * + * @param augmentationType augmentation type to be added or removed + * @param augmentationValue augmentation value, null if the augmentation type should be removed + * @return this builder + * @deprecated Use either {@link #addAugmentation(Augmentation)} or {@link #removeAugmentation(Class)} instead. + */ + @Deprecated(forRemoval = true) + public JujuBuilder addAugmentation(Class> augmentationType, Augmentation augmentationValue) { + return augmentationValue == null ? removeAugmentation(augmentationType) : doAddAugmentation(augmentationType, augmentationValue); + } + + /** + * Remove an augmentation from this builder's product. If this builder does not track such an augmentation + * type, this method does nothing. + * + * @param augmentationType augmentation type to be removed + * @return this builder + */ + public JujuBuilder removeAugmentation(Class> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + private JujuBuilder doAddAugmentation(Class> augmentationType, Augmentation augmentationValue) { + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentationValue); + return this; + } + + @Override + public Juju build() { + return new JujuImpl(this); + } + + private static final class JujuImpl + extends AbstractAugmentable + implements Juju { + + private final org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method.juju.Juju _juju; + + JujuImpl(JujuBuilder base) { + super(base.augmentation); + this._juju = base.getJuju(); + } + + @Override + public org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method.juju.Juju getJuju() { + return _juju; + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_juju); + result = prime * result + Objects.hashCode(augmentations()); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!Juju.class.equals(((DataObject)obj).implementedInterface())) { + return false; + } + Juju other = (Juju)obj; + if (!Objects.equals(_juju, other.getJuju())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + JujuImpl otherImpl = (JujuImpl) obj; + if (!Objects.equals(augmentations(), otherImpl.augmentations())) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry>, Augmentation> e : augmentations().entrySet()) { + if (!e.getValue().equals(other.augmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Juju"); + CodeHelpers.appendValue(helper, "_juju", _juju); + CodeHelpers.appendValue(helper, "augmentation", augmentations().values()); + return helper.toString(); + } + } +} diff --git a/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/Script.java b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/Script.java new file mode 100644 index 0000000000000000000000000000000000000000..6182735eb36aeab369c3bd9c6f2e2c65d4a6c136 --- /dev/null +++ b/src/main/java/org/opendaylight/yang/gen/v1/urn/etsi/osm/yang/augments/norev/configuration/method/config/method/Script.java @@ -0,0 +1,54 @@ +package org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.config.method; +import java.lang.Class; +import java.lang.Override; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.$YangModuleInfoImpl; +import org.opendaylight.yang.gen.v1.urn.etsi.osm.yang.augments.norev.configuration.method.ConfigMethod; +import org.opendaylight.yangtools.yang.binding.Augmentable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; + +/** + * Use custom script for configuring the VNF or VDU. This script is executed in + * context of Orchestrator (The same system and environment as the Launchpad). + * + *

+ * This class represents the following YANG schema fragment defined in module common-augments + *

+ * case script {
+ *   container script {
+ *     leaf script-type {
+ *       type enumeration {
+ *         enum rift;
+ *       }
+ *     }
+ *   }
+ * }
+ * 
The schema path to identify an instance is + * common-augments/configuration-method/config-method/script + * + */ +public interface Script + extends + DataObject, + Augmentable