Add new tests to validate O1 25/7625/4
authorsebdet <sebastien.determe@intl.att.com>
Fri, 28 Jan 2022 08:55:43 +0000 (09:55 +0100)
committerS�bastien Determe <sebastien.determe@intl.att.com>
Fri, 28 Jan 2022 09:38:35 +0000 (09:38 +0000)
Add tests on SDNC + DMaap side
+ rework the different python code
+ Remove pulling of oru-app
+ Add file headers that were missing

Issue-ID: NONRTRIC-669
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: Ie05732c093c0ad884ee7bc180b98e9da982f9117

59 files changed:
smo-install/LICENSE
smo-install/onap_oom
smo-install/oran_oom/du-simulator/Chart.yaml
smo-install/oran_oom/du-simulator/templates/configmap.yaml
smo-install/oran_oom/du-simulator/templates/configmapenv.yaml
smo-install/oran_oom/du-simulator/templates/deployment.yaml
smo-install/oran_oom/du-simulator/templates/service.yaml
smo-install/oran_oom/du-simulator/values.yaml
smo-install/oran_oom/oru-app/values.yaml
smo-install/oran_oom/ru-du-simulators/Chart.yaml
smo-install/oran_oom/ru-du-simulators/requirements.yaml
smo-install/oran_oom/ru-du-simulators/values.yaml
smo-install/oran_oom/ru-simulator/Chart.yaml
smo-install/oran_oom/ru-simulator/templates/configmap.yaml
smo-install/oran_oom/ru-simulator/templates/configmapenv.yaml
smo-install/oran_oom/ru-simulator/templates/deployment.yaml
smo-install/oran_oom/ru-simulator/templates/service.yaml
smo-install/oran_oom/ru-simulator/values.yaml
smo-install/oran_oom/topology-server/Chart.yaml
smo-install/oran_oom/topology-server/templates/configmap.yaml
smo-install/oran_oom/topology-server/templates/configmapenv.yaml
smo-install/oran_oom/topology-server/templates/deployment.yaml
smo-install/oran_oom/topology-server/templates/service.yaml
smo-install/oran_oom/topology-server/values.yaml
smo-install/oran_oom/topology/Chart.yaml
smo-install/oran_oom/topology/templates/configmapenv.yaml
smo-install/oran_oom/topology/templates/deployment.yaml
smo-install/oran_oom/topology/templates/service.yaml
smo-install/oran_oom/topology/values.yaml
smo-install/test/pythonsdk/LICENSE [new file with mode: 0644]
smo-install/test/pythonsdk/src/oransdk/__init__.py
smo-install/test/pythonsdk/src/oransdk/a1policymanagement/__init__.py
smo-install/test/pythonsdk/src/oransdk/a1policymanagement/a1policymanagement.py
smo-install/test/pythonsdk/src/oransdk/a1sim/__init__.py
smo-install/test/pythonsdk/src/oransdk/a1sim/a1sim.py
smo-install/test/pythonsdk/src/oransdk/configuration/__init__.py
smo-install/test/pythonsdk/src/oransdk/configuration/global_settings.py
smo-install/test/pythonsdk/src/oransdk/dmaap/__init__.py
smo-install/test/pythonsdk/src/oransdk/dmaap/dmaap.py
smo-install/test/pythonsdk/src/oransdk/enrichmentservice/__init__.py
smo-install/test/pythonsdk/src/oransdk/enrichmentservice/enrichmentservice.py
smo-install/test/pythonsdk/src/oransdk/policy/__init__.py
smo-install/test/pythonsdk/src/oransdk/policy/policy.py
smo-install/test/pythonsdk/src/oransdk/sdnc/__init__.py
smo-install/test/pythonsdk/src/oransdk/sdnc/sdnc.py
smo-install/test/pythonsdk/src/oransdk/utils/jinja.py
smo-install/test/pythonsdk/src/oransdk/version.py
smo-install/test/pythonsdk/src/orantests/configuration/settings.py
smo-install/test/pythonsdk/src/orantests/conftest.py
smo-install/test/pythonsdk/src/orantests/disable_apex_policy.py [new file with mode: 0644]
smo-install/test/pythonsdk/src/orantests/smo/__init__.py [new file with mode: 0644]
smo-install/test/pythonsdk/src/orantests/smo/network_simulators.py [new file with mode: 0644]
smo-install/test/pythonsdk/src/orantests/smo/nonrtric.py [new file with mode: 0644]
smo-install/test/pythonsdk/src/orantests/smo/onap.py [new file with mode: 0644]
smo-install/test/pythonsdk/src/orantests/smo/smo.py [new file with mode: 0644]
smo-install/test/pythonsdk/src/orantests/test_a1sim.py
smo-install/test/pythonsdk/src/orantests/test_o1.py
smo-install/test/pythonsdk/tox.ini
smo-install/test/topology-generator/network-topology-converter.py

index 8ad1526..540acee 100644 (file)
-================================================================================
-     Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
-================================================================================                                 
-                                 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.
+/*
+* ============LICENSE_START==========================================
+* ORAN SMO PACKAGE
+* ===================================================================
+* Copyright (c) 2021-2022 AT&T Intellectual Property. All rights reserved.
+* ===================================================================
+*
+* Unless otherwise specified, all software contained herein is licensed
+* under the Apache License, Version 2.0 (the â€œLicenseâ€);
+* you may not use this software except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*             http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*
+* Unless otherwise specified, all documentation contained herein is licensed
+* under the Creative Commons License, Attribution 4.0 Intl. (the â€œLicenseâ€);
+* you may not use this documentation except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*             https://creativecommons.org/licenses/by/4.0/
+*
+* Unless required by applicable law or agreed to in writing, documentation
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT 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============================================
+*/ 
index 50c285b..c578bf3 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 50c285b56ae6198420ea3afcfe37086b8a4e9fcf
+Subproject commit c578bf3a8efc1adfa88369eafe358795eb4086ae
index dfbd998..50b0cdb 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: v1
 appVersion: "1.0.0"
 description: A Helm chart for o-du simulator
index b890ef7..1025f78 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 {{ $currentScope := .}}
 {{- range $i, $du := .Values.dus }}
   {{- $_ := set $ "du" $du }}
index 905788e..b3e084b 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 {{- range $i, $du := .Values.dus }}
 ---
 apiVersion: v1
index b5d8dec..6a0fc5b 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 {{- range $i, $du := .Values.dus }}
 ---
 apiVersion: apps/v1
index 32ebb8b..f65d98e 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 {{ range $i, $du := .Values.dus }}
 ---
 apiVersion: v1
index de8f2fb..02e657b 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 # Static Defaults
 image:
   repository: 'nexus3.o-ran-sc.org:10004/o-ran-sc'
index d98eff6..56ae692 100644 (file)
@@ -56,4 +56,4 @@ conf:
 serviceAccount:
   nameOverride: oru-app
   roles:
-    - read
\ No newline at end of file
+    - read
index 9b9b1bf..048debe 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: v1
 name: ru-du-simulators
 version: 1.0.0
index 819c431..4aa848f 100644 (file)
@@ -1,18 +1,16 @@
-################################################################################
-#   Copyright (c) 2020 Nordix Foundation.                                      #
-#                                                                              #
-#   Licensed under the Apache License, Version 2.0 (the "License");            #
-#   you may not use this file except in compliance with the License.           #
-#   You may obtain a copy of the License at                                    #
-#                                                                              #
-#       http://www.apache.org/licenses/LICENSE-2.0                             #
-#                                                                              #
-#   Unless required by applicable law or agreed to in writing, software        #
-#   distributed under the License is distributed on an "AS IS" BASIS,          #
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-#   See the License for the specific language governing permissions and        #
-#   limitations under the License.                                             #
-################################################################################
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 
 dependencies:
   - name: topology-server
index 0845155..68234ef 100644 (file)
@@ -1,18 +1,16 @@
-################################################################################
-#   Copyright (c) 2020 Nordix Foundation.                                      #
-#                                                                              #
-#   Licensed under the Apache License, Version 2.0 (the "License");            #
-#   you may not use this file except in compliance with the License.           #
-#   You may obtain a copy of the License at                                    #
-#                                                                              #
-#       http://www.apache.org/licenses/LICENSE-2.0                             #
-#                                                                              #
-#   Unless required by applicable law or agreed to in writing, software        #
-#   distributed under the License is distributed on an "AS IS" BASIS,          #
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-#   See the License for the specific language governing permissions and        #
-#   limitations under the License.                                             #
-################################################################################
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 
 ru-du-simulators:
   topologyServer: true
index 8287022..8ae370d 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: v1
 appVersion: "1.0.0"
 description: A Helm chart to deploy o-ru-simulator
index 14fe746..30d8fa8 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 {{ $currentScope := .}}
 {{- range $i, $ru := .Values.rus }}
   {{- $_ := set $ "ru" $ru }}
index 4be9b38..c7bba80 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 {{- range $i, $ru := .Values.rus }}
 ---
 apiVersion: v1
index 808cb9e..031ea4f 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 {{- range $i, $ru := .Values.rus }}
 ---
 apiVersion: apps/v1
index 35f475b..4eea8d8 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 {{ range $i, $ru := .Values.rus }}
 ---
 apiVersion: v1
index 343c30e..532ea2e 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 # Static Defaults
 image:
   repository: 'nexus3.o-ran-sc.org:10004/o-ran-sc'
index 9add21c..d59d9c1 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: v1
 appVersion: "1.0.0"
 description: A Helm chart to deploy the topology server
index 4d4a2a9..32b200f 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: v1
 kind: ConfigMap
 metadata:
index 2cffaae..47b2312 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: v1
 kind: ConfigMap
 metadata:
index 8df10b3..d79bcde 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: apps/v1
 kind: Deployment
 metadata:
index 602d635..bbfbeff 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: v1
 kind: Service
 metadata:
index 7e0f838..1a738bb 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 # Static Defaults
 replicaCount: 1
 image:
index 5151338..fab10eb 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: v1
 appVersion: "1.0.0"
 description: A Helm chart to deploy topology
index 9c167dd..8a06b08 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: v1
 kind: ConfigMap
 metadata:
index 52eea18..9da2f13 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: apps/v1
 kind: Deployment
 metadata:
index 2f1d4e3..1ccb79e 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 apiVersion: v1
 kind: Service
 metadata:
index 73f7efd..0781e2b 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright © 2021-2022 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 # Static Defaults
 replicaCount: 1
 image:
diff --git a/smo-install/test/pythonsdk/LICENSE b/smo-install/test/pythonsdk/LICENSE
new file mode 100644 (file)
index 0000000..d5bc3a8
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+* ============LICENSE_START==========================================
+* ORAN SMO PACKAGE - PYTHON SDK TESTS
+* ===================================================================
+* Copyright (c) 2021-2022 AT&T Intellectual Property. All rights reserved.
+* ===================================================================
+*
+* Unless otherwise specified, all software contained herein is licensed
+* under the Apache License, Version 2.0 (the â€œLicenseâ€);
+* you may not use this software except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*             http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*
+* Unless otherwise specified, all documentation contained herein is licensed
+* under the Creative Commons License, Attribution 4.0 Intl. (the â€œLicenseâ€);
+* you may not use this documentation except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*             https://creativecommons.org/licenses/by/4.0/
+*
+* Unless required by applicable law or agreed to in writing, documentation
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT 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============================================
+*/ 
index 5997462..ed594ee 100644 (file)
@@ -1,4 +1,24 @@
 #!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """ORAN SDK master package."""
index 8ebb67e..acd801b 100644 (file)
@@ -1,2 +1,23 @@
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """ONAP A1 policy management package."""
index 25458c6..c6b1925 100644 (file)
@@ -1,11 +1,32 @@
 #!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+
 """ONAP A1 Policy Management."""
 
 from typing import Dict
-from oransdk.configuration import settings
 from onapsdk.onap_service import OnapService
+from oransdk.configuration import settings
 
 class A1policymanagement(OnapService):
     """A1 Policy Management library."""
index 5cdc864..15e3bc1 100644 (file)
@@ -1,2 +1,23 @@
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """ORAN A1 Simulator package."""
index f5c6239..67fd6af 100644 (file)
@@ -1,6 +1,26 @@
 #!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """Oran A1 Simulator module."""
 
 from onapsdk.onap_service import OnapService
index 6d08e60..bd47807 100644 (file)
@@ -1,3 +1,25 @@
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """Configuration module."""
 from onapsdk.configuration.loader import SettingsLoader
 
index 39e85e3..f00dce6 100644 (file)
@@ -1,3 +1,25 @@
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """Global settings module."""  # pylint: disable=bad-whitespace
 ######################
 #                    #
index 421a8db..3dec6d6 100644 (file)
@@ -1,2 +1,23 @@
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """ORAN Dmaap package."""
index 52eac7d..045d99f 100644 (file)
@@ -1,10 +1,30 @@
 #!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """Oran Dmaap module."""
 
-from oransdk.configuration import settings
 from onapsdk.dmaap.dmaap import Dmaap
+from oransdk.configuration import settings
 
 class OranDmaap(Dmaap):
     """Dmaap library provides functions for getting events from Dmaap."""
@@ -21,7 +41,6 @@ class OranDmaap(Dmaap):
 
         Args:
            topic: the topic to create, in json format
-           basic_auth: (Dict[str, str]) for example:{ 'username': 'bob', 'password': 'secret' }
 
         """
         url = f"{cls.base_url}/topics/create"
@@ -65,8 +84,7 @@ class OranDmaap(Dmaap):
 
         """
         url = f"{cls.base_url}/events/{topic}/{dmaap_group}/{dmaap_user}?timeout={timeout}"
-        return cls.send_message('GET',
-                                  'Get payload of specific topic', url)
+        return cls.send_message('GET', 'Get payload of specific topic', url)
 
     @classmethod
     def get_result(cls) -> str:
@@ -79,9 +97,7 @@ class OranDmaap(Dmaap):
         """
         topic = "A1-POLICY-AGENT-WRITE"
         url = f"{cls.base_url}/events/{topic}/users/policy-agent?timeout=15000&limit=100"
-        result = cls.send_message('GET',
-                                  'Get result from previous request',
-                                  url)
+        result = cls.send_message('GET', 'Get result from previous request', url)
         return result
 
     @classmethod
index 1075384..d7ea9f5 100644 (file)
@@ -1,2 +1,23 @@
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """ORAN Enrichment Service package."""
index eeab909..4586ced 100644 (file)
@@ -1,10 +1,30 @@
 #!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """Oran Enrichment Service module."""
 
-from oransdk.configuration import settings
 from onapsdk.onap_service import OnapService
+from oransdk.configuration import settings
 
 class EnrichmentService(OnapService):
     """Enrichment Service library."""
index f96dfc9..f3c98d3 100644 (file)
@@ -1,2 +1,23 @@
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """ONAP Policy package."""
index 3413909..a2d409f 100644 (file)
@@ -1,12 +1,32 @@
 #!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """Onap Policy module."""
 
 from dataclasses import dataclass
 from typing import Dict
-from oransdk.configuration import settings
 from onapsdk.onap_service import OnapService
+from oransdk.configuration import settings
 
 @dataclass
 class PolicyType:
index 5d64d18..2d505ff 100644 (file)
@@ -1,2 +1,23 @@
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """ONAP SDNC package."""
index 2353882..48de22c 100644 (file)
@@ -1,16 +1,37 @@
 #!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """Onap Sdnc module."""
 
 from typing import Dict
-from oransdk.configuration import settings
 from onapsdk.sdnc.sdnc_element import SdncElement
+from oransdk.configuration import settings
 
 class OranSdnc(SdncElement):
     """SDNC library."""
 
     base_url = settings.SDNC_URL
+    header = {"Accept": "application/json", "Content-Type": "application/json"}
 
     @classmethod
     def get_status(cls) -> str:
@@ -50,3 +71,29 @@ class OranSdnc(SdncElement):
                                        url,
                                        basic_auth=basic_auth)
         return status
+
+    @classmethod
+    def get_devices(cls, device_node, basic_auth: Dict[str, str]) -> int:
+        """
+        Get Devices on SDNC.
+
+        Returns:
+           the status of the sdnc component
+        """
+        url = f"{cls.base_url}/rests/data/network-topology:network-topology/topology=topology-netconf/node={device_node}"
+        status = cls.send_message('GET', 'Get status of Device connectivity', url, basic_auth=basic_auth)
+        return status.status_code
+
+    @classmethod
+    def get_events(cls, basic_auth: Dict[str, str], device):
+        """
+        Create device events in Sdnc.
+
+        Args:
+           topic: the event to create, in json format
+           :param basic_auth: (Dict[str, str]) for example:{ 'username': 'bob', 'password': 'secret' }
+           :param device:
+
+        """
+        url = f"{cls.base_url}/rests/operations/data-provider:read-faultlog-list"
+        return cls.send_message('POST', 'Get SDNC events', url, data='{"input": {"filter": [ {"property": "node-id", "filtervalue": "' + device + '"}],"sortorder": [{"property": "timestamp","sortorder": "descending"}],"pagination": {"size": 10,"page": 1}}}', basic_auth=basic_auth)
index f481cb6..f0ab6d6 100644 (file)
@@ -1,5 +1,25 @@
-# -*- coding: utf-8 -*-
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """Jinja module."""
 
 from jinja2 import Environment, PackageLoader, select_autoescape, ChoiceLoader
index 8afbff9..4736cea 100644 (file)
@@ -1,6 +1,26 @@
 #!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 """Version module."""
 
 __version__ = "1.0.0"
index eae0925..4ce3ac3 100644 (file)
@@ -1,4 +1,4 @@
-"""Specific settings module."""  # pylint: disable=bad-whitespace
+"""Specific settings module."""  # pylint: disable=bad-whitespace,line-too-long
 import subprocess
 
 ######################
@@ -69,6 +69,7 @@ NBI_URL         = "https://nbi.api.simpledemo.onap.org:30274"
 NBI_API_VERSION = "/nbi/api/v4"
 
 POLICY_BASICAUTH = { 'username': 'healthcheck', 'password': 'zb!XztG34' }
+SDNC_BASICAUTH = { 'username': 'admin', 'password': 'Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U' }
 
 DMAAP_URL = "http://"+subprocess.run("kubectl get services message-router -n onap |grep message-router | awk '{print $3}'", shell=True, check=True, stdout=subprocess.PIPE).stdout.decode('utf-8').strip()+":3904"
 
@@ -84,6 +85,7 @@ SDNC_URL = "http://"+subprocess.run("kubectl get services sdnc-oam -n onap |grep
 NETWORK_SIMULATORS_RU_LIST = ["o-ru-11211","o-ru-11221","o-ru-11222","o-ru-11223"]
 NETWORK_SIMULATORS_DU_LIST = ["o-du-1121","o-du-1122"]
 NETWORK_SIMULATORS_TOPOLOGY_SERVER = ["topology-server"]
-NETWORK_SIMULATOR_DEVICES_LIST = NETWORK_SIMULATORS_RU_LIST + NETWORK_SIMULATORS_DU_LIST + NETWORK_SIMULATORS_TOPOLOGY_SERVER
+NETWORK_SIMULATORS_DU_RU_LIST = NETWORK_SIMULATORS_DU_LIST + NETWORK_SIMULATORS_RU_LIST
+NETWORK_SIMULATORS_LIST = NETWORK_SIMULATORS_DU_RU_LIST + NETWORK_SIMULATORS_TOPOLOGY_SERVER
 DMAAP_GROUP = "o1test"
 DMAAP_USER = "o1test"
index 50bb0ec..2e78b5b 100644 (file)
@@ -1,16 +1,36 @@
-import pytest
+#!/usr/bin/env python3
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+"""Module called by pytest."""
 import logging
 import logging.config
-from subprocess import check_output, run
-from waiting import wait
-import time
-from onapsdk.configuration import settings
-from oransdk.dmaap.dmaap import OranDmaap
 import os
-import json
-import requests
-
-resources_path="./resources"
+from oransdk.dmaap.dmaap import OranDmaap
+from oransdk.sdnc.sdnc import OranSdnc
+from onapsdk.configuration import settings
+from waiting import wait
+from smo.smo import Smo
+from smo.network_simulators import NetworkSimulators
 
 # Set working dir as python script location
 abspath = os.path.abspath(__file__)
@@ -20,122 +40,58 @@ os.chdir(dname)
 logging.config.dictConfig(settings.LOG_CONFIG)
 logger = logging.getLogger("Test Session setup")
 
-
-def start_network_simulators():
-       logger.info ("Clean up any network simulators")
-       cmd="kubectl delete namespace network"
-       run(cmd, shell=True, check=False)
-       logger.info ("Start the network simulators")
-       cmd="kubectl create namespace network"
-       check_output(cmd, shell=True).decode('utf-8')
-       cmd=f"helm install --debug oran-simulator local/ru-du-simulators --namespace network -f {resources_path}/network-simulators-topology/network-simulators-override.yaml -f {resources_path}/network-simulators-topology/network-simulators-topology-override.yaml"
-       check_output(cmd, shell=True).decode('utf-8')
-
-def get_all_simulators():
-       dockerFilter = check_output("kubectl get services -n network -o name | awk -F \"/\" '{print $2}'", shell=True)
-       return dockerFilter.splitlines()
-
-def stop_network_simulators():
-       cmd="kubectl delete namespace network"
-       return check_output(cmd, shell=True).decode('utf-8')
-
-def is_network_simulators_up():
-       cmd="kubectl get pods --field-selector status.phase!=Running -n network"
-       result=check_output(cmd, shell=True).decode('utf-8')
-       logger.info (f"Checking if network simulators is UP:{result}")
-       if "" == result:
-               logger.info ("Network sims is Up")
-               return True
-       else:
-               logger.info ("Network sims is Down")
-               return False
-
-def is_onap_up():
-       cmd="kubectl get pods --field-selector status.phase!=Running -n onap | wc -l"
-       result=check_output(cmd, shell=True).decode('utf-8')
-       logger.info (f"Checking if ONAP is UP:{result}")
-       if int(result) <= 9:
-               logger.info ("ONAP is Up")
-               return True
-       else:
-               logger.info ("ONAP is Down")
-               return False
-
-def is_nonrtric_up():
-       cmd="kubectl get pods --field-selector status.phase!=Running -n nonrtric | wc -l"
-       result=check_output(cmd, shell=True).decode('utf-8')
-       logger.info (f"Checking if NONRTRIC is UP:{result}")
-       if int(result) == 0:
-               logger.info ("NONRTRIC is Up")
-               return True
-       else:
-               logger.info ("NONRTRIC is Down")
-               return False
-
-def update_event_settings(nfName, nfType):
-       file = f'{resources_path}/faults-config/event-settings-'+nfType+'.json'
-       print ("File name:" + file)
-       with open(file) as json_file:
-               body = json.load(json_file)
-               url = settings.SDNC_URL + '/rests/data/network-topology:network-topology/topology=topology-netconf/node=' + nfName + '/yang-ext:mount/nts-network-function:simulation/network-function'
-               print ("url:"+url)
-               headers = {
-                       'content-type': 'application/yang-data+json',
-                       'accept': 'application/yang-data+json',
-                       'Authorization' : settings.SDNC_AUTH
-               }
-               try:
-                       response = requests.put(url, verify=False, json=body, headers=headers)
-                       print("Response:" + str(response))
-               except requests.exceptions.Timeout:
-                       sys.exit('HTTP request failed, please check you internet connection.')
-               except requests.exceptions.TooManyRedirects:
-                       sys.exit('HTTP request failed, please check your proxy settings.')
-               except requests.exceptions.RequestException as e:
-                       raise SystemExit(e)
-               return response.status_code >= 200 and response.status_code < 300
-
-def enable_events_for_all_simulators():
-       for container in get_all_simulators():
-               name = container.decode("utf-8")
-               if "o-" in name:
-                       if "o-ru" in name:
-                               print("Set", name, update_event_settings(name, "ru"))
-                       if "o-du" in name:
-                               print("Set", name, update_event_settings(name, "du"))
-
-
-def wait_for_smo_to_be_running():
-       wait(lambda: is_onap_up() and is_nonrtric_up(), sleep_seconds=10, timeout_seconds=300, waiting_for="SMO to be ready")
-
-def wait_for_network_simulators_to_be_running():
-       wait(lambda: is_network_simulators_up(), sleep_seconds=10, timeout_seconds=60, waiting_for="Network simulators to be ready")
-
-def pytest_sessionstart(session):
-       wait_for_smo_to_be_running()
-       # Due to an Onap Ves bugs or dmaap ?? DU sims must send messages twice so we need to restart the sims
-       start_network_simulators()
-       wait_for_network_simulators_to_be_running()
-       time.sleep(2)
-       dmaap = OranDmaap()
-        # Do a first get to register the o1test/o1test user in DMAAP, all messages will then be stored for him
-       dmaap.get_message_from_topic("unauthenticated.VES_PNFREG_OUTPUT", 10000, settings.DMAAP_GROUP, settings.DMAAP_USER)
-
-       ## Now kill the simulators and restart them for the test session
-       stop_network_simulators()
-
-       start_network_simulators()
-       wait_for_network_simulators_to_be_running()
-       # Wait enough time to have at least the SDNR notifications sent
-       logger.info ("Waiting 60s that SDNR sends all registration events to VES")
-       time.sleep(60)
-       logger.info ("Enabling faults/events reporting on SDNR")
-       enable_events_for_all_simulators()
-
-       logger.info ("Test Session setup completed successfully")
-
-
-def pytest_sessionfinish(session, exitstatus):
-       stop_network_simulators()
-       logger.info ("Test Session cleanup done")
-
+network_sims = NetworkSimulators("./resources")
+smo = Smo()
+dmaap = OranDmaap()
+sdnc = OranSdnc()
+
+TOPIC_PNFREG = '{"topicName": "unauthenticated.VES_PNFREG_OUTPUT"}'
+
+TOPIC_FAULT = '{"topicName": "unauthenticated.SEC_FAULT_OUTPUT"}'
+
+#TOPIC_PNFREG = {
+#    "owner": "",
+#    "readerAcl": {
+#        "enabled": "true",
+#        "users": []
+#    },
+#    "name": "unauthenticated.VES_PNFREG_OUTPUT",
+#    "description": "",
+#    "writerAcl": {
+#        "enabled": "true",
+#        "users": []
+#    }
+#}
+
+#TOPIC_FAULT = {
+#    "owner": "",
+#    "readerAcl": {
+#        "enabled": "true",
+#        "users": []
+#    },
+#    "name": "unauthenticated.SEC_FAULT_OUTPUT",
+#    "description": "",
+#    "writerAcl": {
+#        "enabled": "true",
+#        "users": []
+#    }
+#}
+
+###### Entry points of PYTEST Session
+def pytest_sessionstart():
+    """Pytest calls it when starting a test session."""
+    logger.info("Check and wait for SMO to be running")
+    smo.wait_for_smo_to_be_running()
+    logger.info("Check and for for SDNC to be running")
+    wait(lambda: OranSdnc.get_events(settings.SDNC_BASICAUTH, "test").status_code == 200, sleep_seconds=10, timeout_seconds=300, waiting_for="SDNC to be ready")
+
+    dmaap.create_topic(TOPIC_PNFREG)
+    dmaap.create_topic(TOPIC_FAULT)
+    ### Due to an Onap Ves/dmaap behavior !!! DU sims must send messages
+    ### twice so we need to create/delete the sims
+#    network_sims.start_network_simulators()
+#    network_sims.wait_for_network_simulators_to_be_running()
+#    time.sleep(20)
+    ## Now kill the simulators and restart them for the test session
+    network_sims.stop_network_simulators()
+    ###### END of FIRST start, now we can start the sims for the real tests.
diff --git a/smo-install/test/pythonsdk/src/orantests/disable_apex_policy.py b/smo-install/test/pythonsdk/src/orantests/disable_apex_policy.py
new file mode 100644 (file)
index 0000000..d5d261a
--- /dev/null
@@ -0,0 +1,147 @@
+#!/usr/bin/env python3
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+"""Apex policy tests module."""
+import time
+import subprocess
+import logging
+import logging.config
+from onapsdk.configuration import settings
+from oransdk.dmaap.dmaap import OranDmaap
+from oransdk.policy.policy import OranPolicy, PolicyType
+from oransdk.sdnc.sdnc import OranSdnc
+from oransdk.utils.jinja import jinja_env
+
+logging.config.dictConfig(settings.LOG_CONFIG)
+logger = logging.getLogger("test APEX policy")
+dmaap = OranDmaap()
+policy = OranPolicy()
+
+def create_new_topic():
+    """Create new topic."""
+    logger.info("Create new topic")
+    topic = '{  "topicName": "unauthenticated.SEC_FAULT_OUTPUT",  "topicDescription": "test topic", "partitionCount": 1,"replicationCnCount": 1,  "transactionEnabled": "false"}'
+    response = dmaap.create_topic(topic)
+    logger.info("response is: %s", response)
+
+    logger.info("Verify topic created")
+    topiclist = dmaap.get_all_topics({})
+    topic_created = False
+    for topic in topiclist:
+        if topic["topicName"] == "unauthenticated.SEC_FAULT_OUTPUT":
+            topic_created = True
+            break
+
+    if topic_created:
+        logger.info("Topic created successfully")
+    else:
+        logger.info("Topic creation failed")
+
+def policy_component_ready():
+    """Check if components are ready."""
+    logger.info("Verify policy components are ready")
+    policy_ready = {"api_ready": False, "pap_ready": False, "apex_ready": False}
+    for x in range(60):
+        logger.info("Iteration %s", x)
+        policy_status = policy.get_components_status(settings.POLICY_BASICAUTH)
+        if (policy_status["api"]["healthy"] and not policy_ready["api_ready"]):
+            logger.info("Policy Api is ready")
+            policy_ready["api_ready"] = True
+        if (policy_status["pap"]["healthy"] and not policy_ready["pap_ready"]):
+            logger.info("Policy Pap is ready")
+            policy_ready["pap_ready"] = True
+        if (policy_status["pdps"]["apex"][0]["healthy"] == "HEALTHY" and not policy_ready["apex_ready"]):
+            logger.info("Policy Apex is ready")
+            policy_ready["apex_ready"] = True
+        if (policy_ready["api_ready"] and policy_ready["pap_ready"] and policy_ready["apex_ready"]):
+            logger.info("Policy status all ready")
+            break
+
+
+    if (not policy_ready["api_ready"] or not policy_ready["pap_ready"] or not policy_ready["apex_ready"]):
+        logger.info("Policy components are not ready. Exit the test.")
+
+def create_policy():
+    """Create the policy."""
+    logger.info("Create policy")
+    policy_data = jinja_env().get_template("ToscaPolicy.json.j2").render()
+    policy.create_policy(PolicyType(type="onap.policies.native.Apex", version="1.0.0"), policy_data, settings.POLICY_BASICAUTH)
+
+    logger.info("Verify whether policy created successfully")
+    policy_response = policy.get_policy(PolicyType(type="onap.policies.native.Apex", version="1.0.0"), "onap.policies.native.apex.LinkMonitor", "1.0.0", settings.POLICY_BASICAUTH)
+    if policy_response:
+        logger.info("Policy created successfully")
+    else:
+        logger.info("Policy creation failed")
+
+def deploy_policy():
+    """Deploy the policy."""
+    logger.info("Deploy policy")
+    policy_to_deploy = jinja_env().get_template("DeployPolicyPAP.json.j2").render()
+    policy.deploy_policy(policy_to_deploy, settings.POLICY_BASICAUTH)
+
+    logger.info("Verify the policy is deployed")
+    policy_status_list = policy.get_policy_status(settings.POLICY_BASICAUTH)
+    policy_deployed = False
+    for status in policy_status_list:
+        logger.info("the status %s,%s,%s:", status["policy"]["name"], status["policy"]["version"], status["deploy"])
+        if (status["policy"]["name"] == "onap.policies.native.apex.LinkMonitor" and status["policy"]["version"] == "1.0.0" and status["deploy"]):
+            policy_deployed = True
+            break
+
+    if policy_deployed:
+        logger.info("Policy deployed successfully")
+    else:
+        logger.info("Failed to deploy policy")
+
+def check_sdnc():
+    """Verify that apex has changed the sdnc status."""
+    logger.info("Check O-du/O-ru status")
+    SDNC_BASICAUTH = {'username': 'admin', 'password': 'Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U'}
+    sdnc = OranSdnc()
+    status = sdnc.get_odu_oru_status("o-du-1122", "o-ru-11221", SDNC_BASICAUTH)
+    if status["o-ran-sc-du-hello-world:du-to-ru-connection"][0]["administrative-state"] == "LOCKED":
+        logger.info("The initial state of o-du o-ru connection is LOCKED")
+
+    logger.info("Wait for a while for Apex engine to be ready before sending Dmaap event")
+    event = jinja_env().get_template("LinkFailureEvent.json.j2").render()
+    for _ in range(60):
+        dmaap.send_link_failure_event(event)
+        if int(subprocess.getoutput('kubectl logs onap-policy-apex-pdp-0 -n onap | grep "Task Selection Execution: \'LinkMonitorPolicy:0.0.1:NULL:LinkFailureOrClearedState\'" | wc -l')) > 0:
+            logger.info("Apex engine is ready. LinkFailureEvent sent to Dmaap")
+            break
+        logger.info("Apex engine not ready yet, wait for a while and try again")
+        time.sleep(2)
+
+    logger.info("Check O-du/O-ru status again")
+    status = sdnc.get_odu_oru_status("o-du-1122", "o-ru-11221", SDNC_BASICAUTH)
+    if status["o-ran-sc-du-hello-world:du-to-ru-connection"][0]["administrative-state"] == "UNLOCKED":
+        logger.info("The updated state of o-du o-ru connection is UNLOCKED")
+
+def test_apex_policy():
+    """Test the apex policy."""
+    create_new_topic()
+    policy_component_ready()
+    create_policy()
+    deploy_policy()
+    check_sdnc()
diff --git a/smo-install/test/pythonsdk/src/orantests/smo/__init__.py b/smo-install/test/pythonsdk/src/orantests/smo/__init__.py
new file mode 100644 (file)
index 0000000..9be020f
--- /dev/null
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+
+"""SMO K8S control package."""
diff --git a/smo-install/test/pythonsdk/src/orantests/smo/network_simulators.py b/smo-install/test/pythonsdk/src/orantests/smo/network_simulators.py
new file mode 100644 (file)
index 0000000..af136a2
--- /dev/null
@@ -0,0 +1,117 @@
+#!/usr/bin/env python3
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+
+"""NetworkSimulators module."""
+import logging
+import logging.config
+import json
+from subprocess import check_output, run
+import sys
+import requests
+from onapsdk.configuration import settings
+from waiting import wait
+
+logging.config.dictConfig(settings.LOG_CONFIG)
+logger = logging.getLogger("Network Simulators k8s")
+
+class NetworkSimulators():
+    """Network simulators controls the simulators k8s deployment."""
+
+    resources_path = ""
+
+    def __init__(self, resources_dir):
+        """Create NetworkSimulators class."""
+        self.resources_path = resources_dir
+
+    def start_network_simulators(self):
+        """Start all simulators defined in resources_path."""
+        logger.info("Start the network simulators")
+        cmd = "kubectl create namespace network"
+        check_output(cmd, shell=True).decode('utf-8')
+        cmd = f"helm install --debug oran-simulator local/ru-du-simulators --namespace network -f {self.resources_path}/network-simulators-topology/network-simulators-override.yaml -f {self.resources_path}/network-simulators-topology/network-simulators-topology-override.yaml"
+        check_output(cmd, shell=True).decode('utf-8')
+
+    @staticmethod
+    def get_all_simulators():
+        """Retrieve all simulators defined in k8s services."""
+        dockerFilter = check_output("kubectl get services -n network -o name | awk -F \"/\" '{print $2}'", shell=True)
+        return dockerFilter.splitlines()
+
+    @staticmethod
+    def stop_network_simulators():
+        """Stop the simulators."""
+        logger.info("Clean up any network simulators")
+        cmd = "kubectl delete namespace network"
+        run(cmd, shell=True, check=False)
+
+    @staticmethod
+    def is_network_simulators_up() -> bool:
+        """Check if the network simulators are up."""
+        cmd = "kubectl get pods --field-selector status.phase!=Running -n network"
+        result = check_output(cmd, shell=True).decode('utf-8')
+        logger.info("Checking if network simulators is UP: %s", result)
+        if result == '':
+            logger.info("Network sims is Up")
+            return True
+        logger.info("Network sims is Down")
+        return False
+
+    def update_event_settings(self, nfName, nfType):
+        """Send one event for specific simulator of a specific type."""
+        file = f'{self.resources_path}/faults-config/event-settings-'+nfType+'.json'
+        logger.info("Faults parameters path: %s", file)
+        with open(file) as json_file:
+            body = json.load(json_file)
+            url = settings.SDNC_URL + '/rests/data/network-topology:network-topology/topology=topology-netconf/node=' + nfName + '/yang-ext:mount/nts-network-function:simulation/network-function'
+            logger.info("Using SDNC URL: %s", url)
+            headers = {
+                'content-type': 'application/yang-data+json',
+                'accept': 'application/yang-data+json',
+                'Authorization' : settings.SDNC_AUTH
+            }
+            try:
+                response = requests.put(url, verify=False, json=body, headers=headers)
+                logger.info("Response: %s", str(response))
+            except requests.exceptions.Timeout:
+                sys.exit('HTTP request failed, please check you internet connection.')
+            except requests.exceptions.TooManyRedirects:
+                sys.exit('HTTP request failed, please check your proxy settings.')
+            except requests.exceptions.RequestException as e:
+                raise SystemExit(e)
+            return response.status_code >= 200 and response.status_code < 300
+
+    def enable_events_for_all_simulators(self):
+        """Send event to sdnc for all sim containers."""
+        for container in NetworkSimulators.get_all_simulators():
+            name = container.decode("utf-8")
+            if "o-" in name:
+                if "o-ru" in name:
+                    logger.info("Set %s %s", name, self.update_event_settings(name, "ru"))
+                if "o-du" in name:
+                    logger.info("Set %s %s", name, self.update_event_settings(name, "du"))
+
+    @staticmethod
+    def wait_for_network_simulators_to_be_running():
+        """Check and wait for the network sims to be running."""
+        wait(lambda: NetworkSimulators.is_network_simulators_up(), sleep_seconds=10, timeout_seconds=60, waiting_for="Network simulators to be ready")
diff --git a/smo-install/test/pythonsdk/src/orantests/smo/nonrtric.py b/smo-install/test/pythonsdk/src/orantests/smo/nonrtric.py
new file mode 100644 (file)
index 0000000..aa84e58
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+
+"""NonrtRic module."""
+import logging
+import logging.config
+from subprocess import check_output
+from onapsdk.configuration import settings
+
+logging.config.dictConfig(settings.LOG_CONFIG)
+logger = logging.getLogger("NonRTRIc k8s")
+
+class NonRTRic():
+    """Control the Nonrtric k8s deployment."""
+
+    @classmethod
+    def is_nonrtric_up(cls):
+        """Check if the nonrtric is up."""
+        cmd = "kubectl get pods --field-selector status.phase!=Running -n nonrtric | wc -l"
+        result = check_output(cmd, shell=True).decode('utf-8')
+        logger.info("Number of NonRTRIC pods not in Running state (expected == 0):%s", result)
+        if int(result) == 0:
+            logger.info("NONRTRIC is Up")
+            return True
+
+        logger.info("NONRTRIC is Down")
+        return False
diff --git a/smo-install/test/pythonsdk/src/orantests/smo/onap.py b/smo-install/test/pythonsdk/src/orantests/smo/onap.py
new file mode 100644 (file)
index 0000000..a494130
--- /dev/null
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+
+"""Onap k8s module."""
+import logging
+
+import logging.config
+
+from subprocess import check_output,run
+from onapsdk.configuration import settings
+
+logging.config.dictConfig(settings.LOG_CONFIG)
+logger = logging.getLogger("Onap k8s")
+
+class Onap():
+    """Can be used to check onap platform in K8S."""
+
+    @classmethod
+    def is_onap_up(cls) -> bool:
+        """Verify if ONAP platform is up or not."""
+        cmd = "kubectl get pods --field-selector 'status.phase=Failed' -n onap -o name | xargs kubectl delete -n onap"
+        run(cmd, shell=True)
+        cmd = "kubectl get pods --field-selector status.phase!=Running -n onap | wc -l"
+        result = check_output(cmd, shell=True).decode('utf-8')
+        logger.info("Number of Onap pods not in Running state (expected <= 8): %s", result)
+        if int(result) <= 8:
+            logger.info("ONAP is Up")
+            return True
+        logger.info("ONAP is Down")
+        return False
diff --git a/smo-install/test/pythonsdk/src/orantests/smo/smo.py b/smo-install/test/pythonsdk/src/orantests/smo/smo.py
new file mode 100644 (file)
index 0000000..49be803
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/env python3
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+
+"""Smo NonRtric module."""
+import logging
+import logging.config
+from onapsdk.configuration import settings
+from waiting import wait
+from smo.onap import Onap
+from smo.nonrtric import NonRTRic
+
+logging.config.dictConfig(settings.LOG_CONFIG)
+logger = logging.getLogger("Smo k8s")
+
+class Smo():
+    """Check SMo nonrtric k8s deployment."""
+
+    onap = Onap()
+    non_rt_ric = NonRTRic()
+
+    @classmethod
+    def wait_for_smo_to_be_running(cls):
+        """Check and wait for the SMo to be running."""
+        wait(lambda: cls.onap.is_onap_up() and cls.non_rt_ric.is_nonrtric_up(), sleep_seconds=10, timeout_seconds=300, waiting_for="SMO to be ready")
index 5a92efb..8f7c387 100644 (file)
@@ -1,10 +1,30 @@
 #!/usr/bin/env python3
-# SPDX-License-Identifier: Apache-2.0
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 
+"""A1Sim tests module."""
 import logging
-from pathlib import Path
 from onapsdk.configuration import settings
-from oransdk.dmaap.dmaap import OranDmaap
 from oransdk.a1sim.a1sim import A1sim
 from oransdk.utils.jinja import jinja_env
 
@@ -14,14 +34,12 @@ logging.config.dictConfig(settings.LOG_CONFIG)
 logger = logging.getLogger("test DMAAP")
 
 def test_a1sim():
+    """Test the A1 sims."""
     logger.info("Get ric version for ost")
     a1sim = A1sim()
-    version1 = a1sim.check_version(settings.A1SIM_OSC_URL)
-
-    status = a1sim.check_status(settings.A1SIM_OSC_URL)
-
-    number = a1sim.get_policy_number(settings.A1SIM_OSC_URL)
+    a1sim.check_version(settings.A1SIM_OSC_URL)
+    a1sim.check_status(settings.A1SIM_OSC_URL)
+    a1sim.get_policy_number(settings.A1SIM_OSC_URL)
 
     data = jinja_env().get_template("OSC/policy_type.json.j2").render()
     a1sim.create_policy_type(settings.A1SIM_OSC_URL, 1, data)
-    assert(True)
index 85771e8..8506ec4 100644 (file)
 #!/usr/bin/env python3
-# SPDX-License-Identifier: Apache-2.0
-
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+"""O1 tests module."""
+import datetime
 import logging
+import json
+import os
+import time
+import pytest
 from onapsdk.configuration import settings
+from smo.network_simulators import NetworkSimulators
 from oransdk.dmaap.dmaap import OranDmaap
-import json
+from oransdk.sdnc.sdnc import OranSdnc
+from waiting import wait
 
-BASIC_AUTH = {}
+# Set working dir as python script location
+abspath = os.path.abspath(__file__)
+dname = os.path.dirname(abspath)
+os.chdir(dname)
 
 logging.config.dictConfig(settings.LOG_CONFIG)
-logger = logging.getLogger("test O1")
-
-def test_network_devices_registration():
-       logger.info("Verify if SDNR sends well the RU registration to VES by checking in DMAAP")
-       dmaap = OranDmaap()
-       # As the user has been registered in DMAAP during test session init, that call should return all sims registered by SDNR
-       events = dmaap.get_message_from_topic("unauthenticated.VES_PNFREG_OUTPUT", 10000, settings.DMAAP_GROUP, settings.DMAAP_USER).json()
-       # events should be a list of messages
-       logger.info("Verify if the number of events is well equals to the number of devices")
-       assert (len(events) >= 6)
-
-       for event in events:
-               logger.info(f"Checking event: {event}")
-               eventjson = json.loads(event)
-               logger.info("json ?"+str(eventjson))
-               assert(eventjson["event"]["commonEventHeader"]["sourceName"] in settings.NETWORK_SIMULATOR_DEVICES_LIST)
-
-               if "o-ru" in eventjson["event"]["commonEventHeader"]["sourceName"]:
-                       logger.info(f"RU event detected checking SDNR has well registered it")
-                       assert(eventjson["event"]["commonEventHeader"]["reportingEntityName"] == "ONAP SDN-R")
-               elif "o-du" in eventjson["event"]["commonEventHeader"]["sourceName"]:
-                       logger.info(f"DU detected checking it has well registered itself")
-                       assert("o-du" in eventjson["event"]["commonEventHeader"]["reportingEntityName"])
+logger = logging.getLogger("Test O1")
+
+network_simulators = NetworkSimulators("./resources")
+dmaap = OranDmaap()
+test_session_timestamp = datetime.datetime.now()
+
+@pytest.fixture(scope="module", autouse=True)
+def setup_simulators():
+    """Setup the simulators before the executing the tests."""
+    logger.info("Test class setup for O1 tests")
+
+    # Do a first get to register the o1test/o1test user in DMAAP
+    # all registration messages will then be stored for the registration tests.
+    # If it exists already it clears all cached events.
+    wait(lambda: (dmaap.get_message_from_topic("unauthenticated.VES_PNFREG_OUTPUT", 5000, settings.DMAAP_GROUP, settings.DMAAP_USER).json() == []), sleep_seconds=10, timeout_seconds=60, waiting_for="DMaap topic unauthenticated.VES_PNFREG_OUTPUT to be empty")
+    wait(lambda: (dmaap.get_message_from_topic("unauthenticated.SEC_FAULT_OUTPUT", 5000, settings.DMAAP_GROUP, settings.DMAAP_USER).json() == []), sleep_seconds=10, timeout_seconds=60, waiting_for="DMaap topic unauthenticated.SEC_FAULT_OUTPUT to be empty")
+    network_simulators.start_network_simulators()
+    network_simulators.wait_for_network_simulators_to_be_running()
+  # ADD DU RESTART just in case
+    # Wait enough time to have at least the SDNR notifications sent
+    logger.info("Waiting 20s that SDNR sends all registration events to VES...")
+    time.sleep(10)
+    logger.info("Enabling faults/events reporting on SDNR")
+    network_simulators.enable_events_for_all_simulators()
+#    logger.info("Waiting 20s that the Dmaap faults topic is created...")
+#    time.sleep(20)
+    # Preparing the DMaap to cache all the events for the fault topics.
+    # If it exists already it clears all cached events.
+    logger.info("Waiting 120s to have registration and faults events in DMaap")
+    time.sleep(120)
+    logger.info("Test Session setup completed successfully")
+
+    ### Cleanup code
+    yield
+    network_simulators.stop_network_simulators()
+    logger.info("Test Session cleanup done")
+
+def create_registration_structure(events):
+    """Decode the registration events list."""
+    devices_found_in_events = dict()
+    for event in events:
+        event_json = json.loads(event)
+        logger.info("Registration json decoded: %s", str(event_json))
+        devices_found_in_events[event_json["event"]["commonEventHeader"]["sourceName"]] = event_json["event"]["commonEventHeader"]["reportingEntityName"]
+
+    logger.info("Devices found in events:%s", devices_found_in_events)
+    return devices_found_in_events
+
+def create_faults_structure(events):
+    """Decode the fault events list."""
+    faults_found_in_events = dict()
+    for event in events:
+        event_json = json.loads(event)
+        logger.info("Fault json decoded: %s", str(event_json))
+        if event_json["event"]["commonEventHeader"]["sourceName"] in faults_found_in_events:
+            faults_found_in_events[event_json["event"]["commonEventHeader"]["sourceName"]] += 1
+        else:
+            faults_found_in_events[event_json["event"]["commonEventHeader"]["sourceName"]] = 1
+    logger.info("Faults found in events: %s", faults_found_in_events)
+    return faults_found_in_events
+
+def test_devices_in_sdnc():
+    """Verify that the devices are well defined in SDNC."""
+    logger.info("Verify if devices are well in SDNC")
+    for device in settings.NETWORK_SIMULATORS_LIST:
+        logger.info("Verify if %s is well in SDNR", device)
+        assert OranSdnc.get_devices(device, settings.SDNC_BASICAUTH) == 200
+
+def validate_faults_timestamp(faults):
+    """Extract only the faults returned by SDNC that have been raised during this test."""
+    valid_faults = []
+    for fault in faults['data-provider:output']['data']:
+        converted_fault_timestamp = datetime.datetime.strptime(fault['timestamp'], "%Y-%m-%dT%H:%M:%S.%fZ")
+        logger.info("Comparing fault timestamp %s (%s) to session test timestamp %s", converted_fault_timestamp, fault['timestamp'], test_session_timestamp)
+        if converted_fault_timestamp > test_session_timestamp:
+            valid_faults.append(fault)
+    logger.info("Valid faults array: %s", valid_faults)
+    return valid_faults
+
+def test_device_faults_in_sdnc():
+    """Verify that the device faults are well defined in SDNC."""
+    logger.info("Verify is there is any events")
+    for device in settings.NETWORK_SIMULATORS_DU_RU_LIST:
+        faults = OranSdnc.get_events(settings.SDNC_BASICAUTH, device).json()
+        logger.info("Verify if %s has events", device)
+        assert len(validate_faults_timestamp(faults)) >= 3
+
+def test_network_devices_registration_in_dmaap():
+    """Validate that the devices are well registered in SDNR and forwarded to VES."""
+    logger.info("Verify if SDNR sends well the RU registration to VES by checking in DMAAP")
+    # As the user has been registered in DMAAP during test session init,
+    # that call should return all sims registered by SDNR
+    all_registrations = []
+    events = []
+
+    while (events := dmaap.get_message_from_topic("unauthenticated.VES_PNFREG_OUTPUT", 30000, settings.DMAAP_GROUP, settings.DMAAP_USER).json()) != []:
+        logger.info("Getting a first set of event: %s", events)
+        all_registrations += events
+
+    logger.info("ALl registration events received: %s", all_registrations)
+    # events should be a list of messages
+    logger.info("Verify if the number of events is well >= to the number of expected devices")
+    # The DU can send multiple times message to VES and SDNR can send multiple time event for RU
+    assert len(all_registrations) >= (len(settings.NETWORK_SIMULATORS_DU_RU_LIST))
+    devices_registered = create_registration_structure(all_registrations)
+
+    # Each device must be at least one time in the event list
+    for sim_name in settings.NETWORK_SIMULATORS_DU_RU_LIST:
+        logger.info("Checking if %s is in events list", sim_name)
+        assert sim_name in devices_registered
+        if "o-ru" in sim_name:
+            logger.info("RU event detected checking SDNR has well registered it")
+            assert "ONAP SDN-R" in devices_registered[sim_name]
+        elif "o-du" in sim_name:
+            logger.info("DU detected checking it has well registered itself")
+            assert "o-du" in devices_registered[sim_name]
+
+def test_device_faults_in_dmaap():
+    """Verify that device faults are well sent to DMAAP by SDNR."""
+    logger.info("Verify if SDNR forwards well the faults sent by the simulators to DMAAP")
+    events = dmaap.get_message_from_topic("unauthenticated.SEC_FAULT_OUTPUT", 30000, settings.DMAAP_GROUP, settings.DMAAP_USER).json()
+    logger.info("Verify if faults have well been received for each device")
+    assert len(events) > 0
+    faults_received = create_faults_structure(events)
+
+    # Each device must have some faults
+    for sim_name in settings.NETWORK_SIMULATORS_DU_RU_LIST:
+        logger.info("Check if %s has at least >=3 faults", sim_name)
+        assert sim_name in faults_received and faults_received[sim_name] >= 3
index 5ce0b66..3e712ee 100644 (file)
@@ -19,18 +19,23 @@ setenv =
     PYTHONPATH = $PYTHONPATH:{toxinidir}/src
     ONAP_PYTHON_SDK_SETTINGS=oransdk.configuration.global_settings
 
-[testenv:oran-tests]
+[testenv:pylint]
 basepython=python3.8
-commands = pytest -v --junit-xml=oran-tests.xml src/orantests/
+commands = pylint --disable=invalid-name,line-too-long,too-few-public-methods,import-error,unnecessary-lambda src/
 setenv =
     PYTHONPATH = $PYTHONPATH:{toxinidir}/src
     ONAP_PYTHON_SDK_SETTINGS=orantests.configuration.settings
 
-
-[testenv:pylint]
-basepython=python3.8
-commands = pylint --disable=invalid-name src/
-
 [testenv:pydocstyle]
 basepython=python3.8
 commands = pydocstyle src/
+setenv =
+    PYTHONPATH = $PYTHONPATH:{toxinidir}/src
+    ONAP_PYTHON_SDK_SETTINGS=orantests.configuration.settings
+
+[testenv:oran-tests]
+basepython=python3.8
+commands = pytest -v --junit-xml=oran-tests.xml src/orantests/
+setenv =
+    PYTHONPATH = $PYTHONPATH:{toxinidir}/src
+    ONAP_PYTHON_SDK_SETTINGS=orantests.configuration.settings
index e2a4c7b..f6f2c3e 100755 (executable)
@@ -1,4 +1,26 @@
 #!/usr/bin/env python3
+###
+# ============LICENSE_START=======================================================
+# ORAN SMO PACKAGE - PYTHONSDK TESTS
+# ================================================================================
+# Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
+#                             reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
 
 import json
 import sys