Browse Source

StarlingX open source release updates

Signed-off-by: Dean Troyer <dtroyer@gmail.com>
changes/83/573983/1
Dean Troyer 3 years ago
parent
commit
6cd8940170
90 changed files with 15576 additions and 0 deletions
  1. +7
    -0
      CONTRIBUTORS.wrs
  2. +202
    -0
      LICENSE
  3. +5
    -0
      README.rst
  4. +6
    -0
      fm-api/.gitignore
  5. +202
    -0
      fm-api/LICENSE
  6. +14
    -0
      fm-api/PKG-INFO
  7. +5
    -0
      fm-api/centos/build_srpm.data
  8. +66
    -0
      fm-api/centos/fm-api.spec
  9. +11
    -0
      fm-api/fm_api/__init__.py
  10. +498
    -0
      fm-api/fm_api/constants.py
  11. +247
    -0
      fm-api/fm_api/fm_api.py
  12. +105
    -0
      fm-api/fm_api_test.py
  13. +17
    -0
      fm-api/setup.py
  14. +6
    -0
      fm-common/.gitignore
  15. +14
    -0
      fm-common/PKG-INFO
  16. +2
    -0
      fm-common/centos/build_srpm.data
  17. +85
    -0
      fm-common/centos/fm-common.spec
  18. +202
    -0
      fm-common/sources/LICENSE
  19. +40
    -0
      fm-common/sources/Makefile
  20. +514
    -0
      fm-common/sources/fmAPI.cpp
  21. +224
    -0
      fm-common/sources/fmAPI.h
  22. +58
    -0
      fm-common/sources/fmAlarm.h
  23. +580
    -0
      fm-common/sources/fmAlarmUtils.cpp
  24. +99
    -0
      fm-common/sources/fmAlarmUtils.h
  25. +199
    -0
      fm-common/sources/fmDb.cpp
  26. +67
    -0
      fm-common/sources/fmDb.h
  27. +49
    -0
      fm-common/sources/fmDbAPI.h
  28. +532
    -0
      fm-common/sources/fmDbAlarm.cpp
  29. +74
    -0
      fm-common/sources/fmDbAlarm.h
  30. +99
    -0
      fm-common/sources/fmDbConstants.h
  31. +318
    -0
      fm-common/sources/fmDbEventLog.cpp
  32. +69
    -0
      fm-common/sources/fmDbEventLog.h
  33. +715
    -0
      fm-common/sources/fmDbUtils.cpp
  34. +94
    -0
      fm-common/sources/fmDbUtils.h
  35. +104
    -0
      fm-common/sources/fmEventSuppression.cpp
  36. +35
    -0
      fm-common/sources/fmEventSuppression.h
  37. +57
    -0
      fm-common/sources/fmFile.cpp
  38. +36
    -0
      fm-common/sources/fmFile.h
  39. +169
    -0
      fm-common/sources/fmLog.cpp
  40. +76
    -0
      fm-common/sources/fmLog.h
  41. +69
    -0
      fm-common/sources/fmMsg.h
  42. +735
    -0
      fm-common/sources/fmMsgServer.cpp
  43. +38
    -0
      fm-common/sources/fmMsgServer.h
  44. +48
    -0
      fm-common/sources/fmMutex.cpp
  45. +45
    -0
      fm-common/sources/fmMutex.h
  46. +69
    -0
      fm-common/sources/fmSnmpConstants.h
  47. +290
    -0
      fm-common/sources/fmSnmpUtils.cpp
  48. +17
    -0
      fm-common/sources/fmSnmpUtils.h
  49. +462
    -0
      fm-common/sources/fmSocket.cpp
  50. +109
    -0
      fm-common/sources/fmSocket.h
  51. +97
    -0
      fm-common/sources/fmThread.cpp
  52. +34
    -0
      fm-common/sources/fmThread.h
  53. +48
    -0
      fm-common/sources/fmTime.cpp
  54. +81
    -0
      fm-common/sources/fmTime.h
  55. +188
    -0
      fm-common/sources/fm_cli.cpp
  56. +195
    -0
      fm-common/sources/fm_db_sync_event_suppression.py
  57. +202
    -0
      fm-doc/LICENSE
  58. +2
    -0
      fm-doc/centos/build_srpm.data
  59. +45
    -0
      fm-doc/centos/fm-doc.spec
  60. +202
    -0
      fm-doc/fm_doc/LICENSE
  61. +33
    -0
      fm-doc/fm_doc/checkEventYaml
  62. +113
    -0
      fm-doc/fm_doc/check_missing_alarms.py
  63. +3098
    -0
      fm-doc/fm_doc/events.yaml
  64. +196
    -0
      fm-doc/fm_doc/parseEventYaml.py
  65. +2
    -0
      fm-mgr/PKG-INFO
  66. +2
    -0
      fm-mgr/centos/build_srpm.data
  67. +50
    -0
      fm-mgr/centos/fm-mgr.spec
  68. +202
    -0
      fm-mgr/sources/LICENSE
  69. +30
    -0
      fm-mgr/sources/Makefile
  70. +8
    -0
      fm-mgr/sources/fm.conf
  71. +35
    -0
      fm-mgr/sources/fm.logrotate
  72. +59
    -0
      fm-mgr/sources/fm_main.cpp
  73. +111
    -0
      fm-mgr/sources/fminit
  74. +17
    -0
      fm-mgr/sources/fminit.service
  75. +6
    -0
      mwa-cleo.map
  76. +2
    -0
      snmp-audittrail/centos/build_srpm.data
  77. +56
    -0
      snmp-audittrail/centos/snmp-audittrail.spec
  78. +202
    -0
      snmp-audittrail/sources/LICENSE
  79. +25
    -0
      snmp-audittrail/sources/Makefile
  80. +422
    -0
      snmp-audittrail/sources/snmpAuditPlugin.c
  81. +3
    -0
      snmp-ext/centos/build_srpm.data
  82. +82
    -0
      snmp-ext/centos/snmp-ext.spec
  83. +818
    -0
      snmp-ext/mibs/wrsAlarmMib.mib.txt
  84. +132
    -0
      snmp-ext/mibs/wrsEnterpriseReg.mib.txt
  85. +202
    -0
      snmp-ext/sources/LICENSE
  86. +25
    -0
      snmp-ext/sources/Makefile
  87. +266
    -0
      snmp-ext/sources/cgtsActiveAlarms.c
  88. +164
    -0
      snmp-ext/sources/cgtsAgentPlugin.c
  89. +69
    -0
      snmp-ext/sources/cgtsAgentPlugin.h
  90. +268
    -0
      snmp-ext/sources/cgtsEventLogs.c

+ 7
- 0
CONTRIBUTORS.wrs View File

@ -0,0 +1,7 @@
The following contributors from Wind River have developed the seed code in this
repository. We look forward to community collaboration and contributions for
additional features, enhancements and refactoring.
Contributors:
=============
Tao Liu <Tao.Liu@windriver.com>

+ 202
- 0
LICENSE View File

@ -0,0 +1,202 @@
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.

+ 5
- 0
README.rst View File

@ -0,0 +1,5 @@
=========
stx-fault
=========
StarlingX Fault Management

+ 6
- 0
fm-api/.gitignore View File

@ -0,0 +1,6 @@
!.distro
.distro/centos7/rpmbuild/RPMS
.distro/centos7/rpmbuild/SRPMS
.distro/centos7/rpmbuild/BUILD
.distro/centos7/rpmbuild/BUILDROOT
.distro/centos7/rpmbuild/SOURCES/fm-api*tar.gz

+ 202
- 0
fm-api/LICENSE View File

@ -0,0 +1,202 @@
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.

+ 14
- 0
fm-api/PKG-INFO View File

@ -0,0 +1,14 @@
Metadata-Version: 1.1
Name: fm-api
Version: 1.0
Summary: CGTS Platform Fault Management Python API Package
Home-page:
Author: Windriver
Author-email: info@windriver.com
License: Apache-2.0
Description: CGTS platform Fault Management Client Library that provides APIs \
for applications to raise/clear/update active alarms.
Platform: UNKNOWN

+ 5
- 0
fm-api/centos/build_srpm.data View File

@ -0,0 +1,5 @@
SRC_DIR="."
COPY_LIST="$PKG_BASE/LICENSE"
EXCLUDE_FILES_FROM_TAR="centos"
TIS_PATCH_VER=13

+ 66
- 0
fm-api/centos/fm-api.spec View File

@ -0,0 +1,66 @@
Summary: CGTS Platform Fault Management Python API Package
Name: fm-api
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: %{name}-%{version}.tar.gz
Source1: LICENSE
%define debug_package %{nil}
BuildRequires: python-setuptools
%description
CGTS platform Fault Management Client Library that provides APIs
for applications to raise/clear/update active alarms.
%package -n fm-api-doc
Summary: fm-api deploy doc
Group: doc
Provides: fm-api-doc
%description -n fm-api-doc
Contains contansts which is to be used by fm-doc package to validate
the Alarms & Logs Doc Yaml file
%define pythonroot /usr/lib64/python2.7/site-packages
%define cgcs_doc_deploy_dir /opt/deploy/cgcs_doc
%prep
%setup
%build
%{__python} setup.py build
%install
%{__python} setup.py install --root=$RPM_BUILD_ROOT \
--install-lib=%{pythonroot} \
--prefix=/usr \
--install-data=/usr/share \
--single-version-externally-managed
CGCS_DOC_DEPLOY=$RPM_BUILD_ROOT/%{cgcs_doc_deploy_dir}
install -d $CGCS_DOC_DEPLOY
# install constants.py in CGCS_DOC_DEPLOY_DIR
# used by fm-doc package to validate the Alarms & Logs Doc Yaml file
install -m 644 fm_api/constants.py $CGCS_DOC_DEPLOY
%clean
rm -rf $RPM_BUILD_ROOT
# Note: RPM package name is fm-api but import package name is fm_api so can't
# use '%{name}'.
%files
%license LICENSE
%defattr(-,root,root,-)
%dir %{pythonroot}/fm_api
%{pythonroot}/fm_api/*
%dir %{pythonroot}/fm_api-%{version}.0-py2.7.egg-info
%{pythonroot}/fm_api-%{version}.0-py2.7.egg-info/*
%files -n fm-api-doc
%defattr(-,root,root,-)
%{cgcs_doc_deploy_dir}/*

+ 11
- 0
fm-api/fm_api/__init__.py View File

@ -0,0 +1,11 @@
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 Wind River Inc.
# All Rights Reserved.
#

+ 498
- 0
fm-api/fm_api/constants.py View File

@ -0,0 +1,498 @@
#
# Copyright (c) 2013-2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- encoding: utf-8 -*-
#
#
# Author: Tao Liu
#
# This file contains CGTS alarm definitions. The alarm ids that used by Python
# applications are defined here. For a completed alarm id list see the alarm ids
# that used by the C/C++ applications defined in
# fm-common/sources/fmAlarm.h
################################################################################
#
# Please make sure that all FM_ALARM_ID_xxx entries in this file
# have a corresponding Alarm record entry in file events.yaml
#
################################################################################
# alarm sub entity types
FM_ENTITY_TYPE_SYSTEM = 'system'
FM_ENTITY_TYPE_HOST = 'host'
FM_ENTITY_TYPE_PORT = 'port'
FM_ENTITY_TYPE_INTERFACE = 'interface'
FM_ENTITY_TYPE_SERVICE = 'service'
FM_ENTITY_TYPE_AGENT = 'agent'
FM_ENTITY_TYPE_PROVIDERNET = 'providernet'
FM_ENTITY_TYPE_INSTANCE = 'instance'
FM_ENTITY_TYPE_CLUSTER = 'cluster'
FM_ENTITY_TYPE_NTP = 'ntp'
FM_ENTITY_TYPE_ML2DRIVER = 'ml2driver'
FM_ENTITY_TYPE_PV = 'pv'
FM_ENTITY_TYPE_BGP_PEER = "bgp-peer"
FM_ENTITY_TYPE_STORAGE_BACKEND = 'storage_backend'
FM_ENTITY_TYPE_SUBCLOUD = 'subcloud'
# alarm service sub entity values
FM_SERVICE_NETWORKING = 'networking'
# alarm_id = <Alarm Group ID>.<Alarm Event ID>
# <Alarm Group ID> = 000 - 999
# <Alarm Event ID> = 000 999
ALARM_GROUP_GENERAL = "100"
ALARM_GROUP_MAINTENANCE = "200"
ALARM_GROUP_BACKUP_RESTORE = "210"
ALARM_GROUP_SYSCONFIG = "250"
ALARM_GROUP_HOST_SERVICES = "270"
ALARM_GROUP_HYPERVISOR = "275"
ALARM_GROUP_DISTRIBUTED_CLOUD = "280"
ALARM_GROUP_NETWORK = "300"
ALARM_GROUP_HA = "400"
ALARM_GROUP_SECURITY = "500"
ALARM_GROUP_LICENSING = "600"
ALARM_GROUP_VM = "700"
ALARM_GROUP_STORAGE = "800"
ALARM_GROUP_SW_MGMT = "900"
# Maintenance Log id
FM_LOG_ID_HOST_DISCOVERED = ALARM_GROUP_MAINTENANCE + ".020"
# System Config Alarm id
FM_ALARM_ID_SYSCONFIG_OUT_OF_DATE = ALARM_GROUP_SYSCONFIG + ".001"
# This CONFIG_REQD alarm ID is deprecated and commented out to avoid its
# alarm id .010 from being unintentinally reused for some unrelated purpose.
# Deprecation followed the removal of the compute-config-complete command.
# FM_ALARM_ID_CONFIG_REQD = ALARM_GROUP_SYSCONFIG + ".010"
FM_ALARM_ID_CEPH_CACHE_TIER_CONFIG_OUT_OF_DATE = ALARM_GROUP_SYSCONFIG + ".002"
# Backup/Restore Alarm id
FM_ALARM_ID_BACKUP_IN_PROGRESS = ALARM_GROUP_BACKUP_RESTORE + ".001"
# Backup/Restore Log id
FM_LOG_ID_RESTORE_COMPLETE = ALARM_GROUP_BACKUP_RESTORE + ".101"
# Network alarm id
FM_ALARM_ID_NETWORK_PORT = ALARM_GROUP_NETWORK + ".001"
FM_ALARM_ID_NETWORK_INTERFACE = ALARM_GROUP_NETWORK + ".002"
FM_ALARM_ID_NETWORK_AGENT = ALARM_GROUP_NETWORK + ".003"
FM_ALARM_ID_NETWORK_PROVIDERNET = ALARM_GROUP_NETWORK + ".004"
FM_ALARM_ID_NETWORK_PROVIDERNET_CONNECTIVITY = ALARM_GROUP_NETWORK + ".005"
FM_ALARM_ID_NETWORK_ML2_DRIVER = ALARM_GROUP_NETWORK + ".010"
FM_ALARM_ID_NETWORK_OPENFLOW_CONTROLLER = ALARM_GROUP_NETWORK + ".012"
FM_ALARM_ID_NETWORK_OVSDB_MANAGER = ALARM_GROUP_NETWORK + ".014"
FM_ALARM_ID_NETWORK_BGP_PEER = ALARM_GROUP_NETWORK + ".016"
# Storage alarm id
FM_ALARM_ID_STORAGE_CEPH_CRITICAL = ALARM_GROUP_STORAGE + ".010"
FM_ALARM_ID_STORAGE_CEPH_MAJOR = ALARM_GROUP_STORAGE + ".011"
FM_ALARM_ID_STORAGE_CEPH = ALARM_GROUP_STORAGE + ".001"
FM_ALARM_ID_STORAGE_IMAGE = ALARM_GROUP_STORAGE + ".002"
FM_ALARM_ID_STORAGE_CEPH_FREE_SPACE = ALARM_GROUP_STORAGE + ".003"
FM_ALARM_ID_STORAGE_CINDER_IO_BUILDING = ALARM_GROUP_STORAGE + ".100"
FM_ALARM_ID_STORAGE_CINDER_IO_LIMITING = ALARM_GROUP_STORAGE + ".101"
FM_ALARM_ID_STORAGE_PV_FAILED = ALARM_GROUP_STORAGE + ".102"
# Alarm .103 is reserved for LVM thin pool metadata alarm
FM_ALARM_ID_STORAGE_BACKEND_FAILED = ALARM_GROUP_STORAGE + ".104"
# Host-Services alarm id
FM_ALARM_ID_HOST_SERVICES_FAILED = ALARM_GROUP_HOST_SERVICES + ".001"
# Host-Services log id
FM_LOG_ID_HOST_SERVICES_FAILED = ALARM_GROUP_HOST_SERVICES + ".101"
FM_LOG_ID_HOST_SERVICES_ENABLED = ALARM_GROUP_HOST_SERVICES + ".102"
FM_LOG_ID_HOST_SERVICES_DISABLED = ALARM_GROUP_HOST_SERVICES + ".103"
# Hypervisor log id
FM_LOG_ID_HYPERVISOR_STATE_CHANGE = ALARM_GROUP_HYPERVISOR + ".001"
# Distributed Cloud alarm id
FM_ALARM_ID_DC_SUBCLOUD_OFFLINE = ALARM_GROUP_DISTRIBUTED_CLOUD + ".001"
FM_ALARM_ID_DC_SUBCLOUD_RESOURCE_OUT_OF_SYNC = ALARM_GROUP_DISTRIBUTED_CLOUD + ".002"
# VM alarm id
FM_ALARM_ID_VM_FAILED = ALARM_GROUP_VM + ".001"
FM_ALARM_ID_VM_PAUSED = ALARM_GROUP_VM + ".002"
FM_ALARM_ID_VM_SUSPENDED = ALARM_GROUP_VM + ".003"
FM_ALARM_ID_VM_STOPPED = ALARM_GROUP_VM + ".004"
FM_ALARM_ID_VM_REBOOTING = ALARM_GROUP_VM + ".005"
FM_ALARM_ID_VM_REBUILDING = ALARM_GROUP_VM + ".006"
FM_ALARM_ID_VM_EVACUATING = ALARM_GROUP_VM + ".007"
FM_ALARM_ID_VM_LIVE_MIGRATING = ALARM_GROUP_VM + ".008"
FM_ALARM_ID_VM_COLD_MIGRATING = ALARM_GROUP_VM + ".009"
FM_ALARM_ID_VM_COLD_MIGRATED = ALARM_GROUP_VM + ".010"
FM_ALARM_ID_VM_COLD_MIGRATE_REVERTING = ALARM_GROUP_VM + ".011"
FM_ALARM_ID_VM_RESIZING = ALARM_GROUP_VM + ".012"
FM_ALARM_ID_VM_RESIZED = ALARM_GROUP_VM + ".013"
FM_ALARM_ID_VM_RESIZE_REVERTING = ALARM_GROUP_VM + ".014"
FM_ALARM_ID_VM_GUEST_HEARTBEAT = ALARM_GROUP_VM + ".015"
FM_ALARM_ID_VM_MULTI_NODE_RECOVERY_MODE = ALARM_GROUP_VM + ".016"
FM_ALARM_ID_VM_GROUP_POLICY_CONFLICT = ALARM_GROUP_VM + ".017"
# VM log id
FM_LOG_ID_VM_ENABLED = ALARM_GROUP_VM + ".101"
FM_LOG_ID_VM_FAILED = ALARM_GROUP_VM + ".102"
FM_LOG_ID_VM_CREATE = ALARM_GROUP_VM + ".103"
FM_LOG_ID_VM_CREATING = ALARM_GROUP_VM + ".104"
FM_LOG_ID_VM_CREATE_REJECTED = ALARM_GROUP_VM + ".105"
FM_LOG_ID_VM_CREATE_CANCELLED = ALARM_GROUP_VM + ".106"
FM_LOG_ID_VM_CREATE_FAILED = ALARM_GROUP_VM + ".107"
FM_LOG_ID_VM_CREATED = ALARM_GROUP_VM + ".108"
FM_LOG_ID_VM_DELETE = ALARM_GROUP_VM + ".109"
FM_LOG_ID_VM_DELETING = ALARM_GROUP_VM + ".110"
FM_LOG_ID_VM_DELETE_REJECTED = ALARM_GROUP_VM + ".111"
FM_LOG_ID_VM_DELETE_CANCELLED = ALARM_GROUP_VM + ".112"
FM_LOG_ID_VM_DELETE_FAILED = ALARM_GROUP_VM + ".113"
FM_LOG_ID_VM_DELETED = ALARM_GROUP_VM + ".114"
FM_LOG_ID_VM_PAUSE = ALARM_GROUP_VM + ".115"
FM_LOG_ID_VM_PAUSING = ALARM_GROUP_VM + ".116"
FM_LOG_ID_VM_PAUSE_REJECTED = ALARM_GROUP_VM + ".117"
FM_LOG_ID_VM_PAUSE_CANCELLED = ALARM_GROUP_VM + ".118"
FM_LOG_ID_VM_PAUSE_FAILED = ALARM_GROUP_VM + ".119"
FM_LOG_ID_VM_PAUSED = ALARM_GROUP_VM + ".120"
FM_LOG_ID_VM_UNPAUSE = ALARM_GROUP_VM + ".121"
FM_LOG_ID_VM_UNPAUSING = ALARM_GROUP_VM + ".122"
FM_LOG_ID_VM_UNPAUSE_REJECTED = ALARM_GROUP_VM + ".123"
FM_LOG_ID_VM_UNPAUSE_CANCELLED = ALARM_GROUP_VM + ".124"
FM_LOG_ID_VM_UNPAUSE_FAILED = ALARM_GROUP_VM + ".125"
FM_LOG_ID_VM_UNPAUSED = ALARM_GROUP_VM + ".126"
FM_LOG_ID_VM_SUSPEND = ALARM_GROUP_VM + ".127"
FM_LOG_ID_VM_SUSPENDING = ALARM_GROUP_VM + ".128"
FM_LOG_ID_VM_SUSPEND_REJECTED = ALARM_GROUP_VM + ".129"
FM_LOG_ID_VM_SUSPEND_CANCELLED = ALARM_GROUP_VM + ".130"
FM_LOG_ID_VM_SUSPEND_FAILED = ALARM_GROUP_VM + ".131"
FM_LOG_ID_VM_SUSPENDED = ALARM_GROUP_VM + ".132"
FM_LOG_ID_VM_RESUME = ALARM_GROUP_VM + ".133"
FM_LOG_ID_VM_RESUMING = ALARM_GROUP_VM + ".134"
FM_LOG_ID_VM_RESUME_REJECTED = ALARM_GROUP_VM + ".135"
FM_LOG_ID_VM_RESUME_CANCELLED = ALARM_GROUP_VM + ".136"
FM_LOG_ID_VM_RESUME_FAILED = ALARM_GROUP_VM + ".137"
FM_LOG_ID_VM_RESUMED = ALARM_GROUP_VM + ".138"
FM_LOG_ID_VM_START = ALARM_GROUP_VM + ".139"
FM_LOG_ID_VM_STARTING = ALARM_GROUP_VM + ".140"
FM_LOG_ID_VM_START_REJECTED = ALARM_GROUP_VM + ".141"
FM_LOG_ID_VM_START_CANCELLED = ALARM_GROUP_VM + ".142"
FM_LOG_ID_VM_START_FAILED = ALARM_GROUP_VM + ".143"
FM_LOG_ID_VM_STARTED = ALARM_GROUP_VM + ".144"
FM_LOG_ID_VM_STOP = ALARM_GROUP_VM + ".145"
FM_LOG_ID_VM_STOPPING = ALARM_GROUP_VM + ".146"
FM_LOG_ID_VM_STOP_REJECTED = ALARM_GROUP_VM + ".147"
FM_LOG_ID_VM_STOP_CANCELLED = ALARM_GROUP_VM + ".148"
FM_LOG_ID_VM_STOP_FAILED = ALARM_GROUP_VM + ".149"
FM_LOG_ID_VM_STOPPED = ALARM_GROUP_VM + ".150"
FM_LOG_ID_VM_LIVE_MIGRATE = ALARM_GROUP_VM + ".151"
FM_LOG_ID_VM_LIVE_MIGRATING = ALARM_GROUP_VM + ".152"
FM_LOG_ID_VM_LIVE_MIGRATE_REJECTED = ALARM_GROUP_VM + ".153"
FM_LOG_ID_VM_LIVE_MIGRATE_CANCELLED = ALARM_GROUP_VM + ".154"
FM_LOG_ID_VM_LIVE_MIGRATE_FAILED = ALARM_GROUP_VM + ".155"
FM_LOG_ID_VM_LIVE_MIGRATED = ALARM_GROUP_VM + ".156"
FM_LOG_ID_VM_COLD_MIGRATE = ALARM_GROUP_VM + ".157"
FM_LOG_ID_VM_COLD_MIGRATING = ALARM_GROUP_VM + ".158"
FM_LOG_ID_VM_COLD_MIGRATE_REJECTED = ALARM_GROUP_VM + ".159"
FM_LOG_ID_VM_COLD_MIGRATE_CANCELLED = ALARM_GROUP_VM + ".160"
FM_LOG_ID_VM_COLD_MIGRATE_FAILED = ALARM_GROUP_VM + ".161"
FM_LOG_ID_VM_COLD_MIGRATED = ALARM_GROUP_VM + ".162"
FM_LOG_ID_VM_COLD_MIGRATE_CONFIRM = ALARM_GROUP_VM + ".163"
FM_LOG_ID_VM_COLD_MIGRATE_CONFIRMING = ALARM_GROUP_VM + ".164"
FM_LOG_ID_VM_COLD_MIGRATE_CONFIRM_REJECTED = ALARM_GROUP_VM + ".165"
FM_LOG_ID_VM_COLD_MIGRATE_CONFIRM_CANCELLED = ALARM_GROUP_VM + ".166"
FM_LOG_ID_VM_COLD_MIGRATE_CONFIRM_FAILED = ALARM_GROUP_VM + ".167"
FM_LOG_ID_VM_COLD_MIGRATE_CONFIRMED = ALARM_GROUP_VM + ".168"
FM_LOG_ID_VM_COLD_MIGRATE_REVERT = ALARM_GROUP_VM + ".169"
FM_LOG_ID_VM_COLD_MIGRATE_REVERTING = ALARM_GROUP_VM + ".170"
FM_LOG_ID_VM_COLD_MIGRATE_REVERT_REJECTED = ALARM_GROUP_VM + ".171"
FM_LOG_ID_VM_COLD_MIGRATE_REVERT_CANCELLED = ALARM_GROUP_VM + ".172"
FM_LOG_ID_VM_COLD_MIGRATE_REVERT_FAILED = ALARM_GROUP_VM + ".173"
FM_LOG_ID_VM_COLD_MIGRATE_REVERTED = ALARM_GROUP_VM + ".174"
FM_LOG_ID_VM_EVACUATE = ALARM_GROUP_VM + ".175"
FM_LOG_ID_VM_EVACUATING = ALARM_GROUP_VM + ".176"
FM_LOG_ID_VM_EVACUATE_REJECTED = ALARM_GROUP_VM + ".177"
FM_LOG_ID_VM_EVACUATE_CANCELLED = ALARM_GROUP_VM + ".178"
FM_LOG_ID_VM_EVACUATE_FAILED = ALARM_GROUP_VM + ".179"
FM_LOG_ID_VM_EVACUATED = ALARM_GROUP_VM + ".180"
FM_LOG_ID_VM_REBOOT = ALARM_GROUP_VM + ".181"
FM_LOG_ID_VM_REBOOTING = ALARM_GROUP_VM + ".182"
FM_LOG_ID_VM_REBOOT_REJECTED = ALARM_GROUP_VM + ".183"
FM_LOG_ID_VM_REBOOT_CANCELLED = ALARM_GROUP_VM + ".184"
FM_LOG_ID_VM_REBOOT_FAILED = ALARM_GROUP_VM + ".185"
FM_LOG_ID_VM_REBOOTED = ALARM_GROUP_VM + ".186"
FM_LOG_ID_VM_REBUILD = ALARM_GROUP_VM + ".187"
FM_LOG_ID_VM_REBUILDING = ALARM_GROUP_VM + ".188"
FM_LOG_ID_VM_REBUILD_REJECTED = ALARM_GROUP_VM + ".189"
FM_LOG_ID_VM_REBUILD_CANCELLED = ALARM_GROUP_VM + ".190"
FM_LOG_ID_VM_REBUILD_FAILED = ALARM_GROUP_VM + ".191"
FM_LOG_ID_VM_REBUILT = ALARM_GROUP_VM + ".192"
FM_LOG_ID_VM_RESIZE = ALARM_GROUP_VM + ".193"
FM_LOG_ID_VM_RESIZING = ALARM_GROUP_VM + ".194"
FM_LOG_ID_VM_RESIZE_REJECTED = ALARM_GROUP_VM + ".195"
FM_LOG_ID_VM_RESIZE_CANCELLED = ALARM_GROUP_VM + ".196"
FM_LOG_ID_VM_RESIZE_FAILED = ALARM_GROUP_VM + ".197"
FM_LOG_ID_VM_RESIZED = ALARM_GROUP_VM + ".198"
FM_LOG_ID_VM_RESIZE_CONFIRM = ALARM_GROUP_VM + ".199"
FM_LOG_ID_VM_RESIZE_CONFIRMING = ALARM_GROUP_VM + ".200"
FM_LOG_ID_VM_RESIZE_CONFIRM_REJECTED = ALARM_GROUP_VM + ".201"
FM_LOG_ID_VM_RESIZE_CONFIRM_CANCELLED = ALARM_GROUP_VM + ".202"
FM_LOG_ID_VM_RESIZE_CONFIRM_FAILED = ALARM_GROUP_VM + ".203"
FM_LOG_ID_VM_RESIZE_CONFIRMED = ALARM_GROUP_VM + ".204"
FM_LOG_ID_VM_RESIZE_REVERT = ALARM_GROUP_VM + ".205"
FM_LOG_ID_VM_RESIZE_REVERTING = ALARM_GROUP_VM + ".206"
FM_LOG_ID_VM_RESIZE_REVERT_REJECTED = ALARM_GROUP_VM + ".207"
FM_LOG_ID_VM_RESIZE_REVERT_CANCELLED = ALARM_GROUP_VM + ".208"
FM_LOG_ID_VM_RESIZE_REVERT_FAILED = ALARM_GROUP_VM + ".209"
FM_LOG_ID_VM_RESIZE_REVERTED = ALARM_GROUP_VM + ".210"
FM_LOG_ID_VM_GUEST_HEARTBEAT_ESTABLISHED = ALARM_GROUP_VM + ".211"
FM_LOG_ID_VM_GUEST_HEARTBEAT_DISCONNECTED = ALARM_GROUP_VM + ".212"
FM_LOG_ID_VM_GUEST_HEARTBEAT_FAILED = ALARM_GROUP_VM + ".213"
FM_LOG_ID_VM_RENAMED = ALARM_GROUP_VM + ".214"
FM_LOG_ID_VM_GUEST_HEALTH_CHECK_FAILED = ALARM_GROUP_VM + ".215"
FM_LOG_ID_VM_MULTI_NODE_RECOVERY_MODE_ENTER = ALARM_GROUP_VM + ".216"
FM_LOG_ID_VM_MULTI_NODE_RECOVERY_MODE_EXIT = ALARM_GROUP_VM + ".217"
# Patching alarm id
FM_ALARM_ID_PATCH_IN_PROGRESS = ALARM_GROUP_SW_MGMT + ".001"
FM_ALARM_ID_PATCH_HOST_INSTALL_FAILED = ALARM_GROUP_SW_MGMT + ".002"
FM_ALARM_ID_PATCH_OBS_IN_SYSTEM = ALARM_GROUP_SW_MGMT + ".003"
# Upgrades alarm id
FM_ALARM_ID_HOST_VERSION_MISMATCH = ALARM_GROUP_SW_MGMT + ".004"
FM_ALARM_ID_UPGRADE_IN_PROGRESS = ALARM_GROUP_SW_MGMT + ".005"
# Security log id
FM_LOG_ID_INVALID_PASSWORD = ALARM_GROUP_SECURITY + ".001"
FM_LOG_ID_USER_LOCKOUT = ALARM_GROUP_SECURITY + ".002"
# Security alarm id
FM_ALARM_ID_TPM_INIT = ALARM_GROUP_SECURITY + ".100"
# Security nonstandard certificate in use for patching alarm id
FM_ALARM_ID_NONSTANDARD_CERT_PATCH = ALARM_GROUP_SECURITY + ".101"
# Software Update Orchestration
FM_ALARM_ID_SW_PATCH_AUTO_APPLY_INPROGRESS = ALARM_GROUP_SW_MGMT + ".101"
FM_ALARM_ID_SW_PATCH_AUTO_APPLY_ABORTING = ALARM_GROUP_SW_MGMT + ".102"
FM_ALARM_ID_SW_PATCH_AUTO_APPLY_FAILED = ALARM_GROUP_SW_MGMT + ".103"
FM_LOG_ID_SW_PATCH_AUTO_APPLY_START = ALARM_GROUP_SW_MGMT + ".111"
FM_LOG_ID_SW_PATCH_AUTO_APPLY_INPROGRESS = ALARM_GROUP_SW_MGMT + ".112"
FM_LOG_ID_SW_PATCH_AUTO_APPLY_REJECTED = ALARM_GROUP_SW_MGMT + ".113"
FM_LOG_ID_SW_PATCH_AUTO_APPLY_CANCELLED = ALARM_GROUP_SW_MGMT + ".114"
FM_LOG_ID_SW_PATCH_AUTO_APPLY_FAILED = ALARM_GROUP_SW_MGMT + ".115"
FM_LOG_ID_SW_PATCH_AUTO_APPLY_COMPLETED = ALARM_GROUP_SW_MGMT + ".116"
FM_LOG_ID_SW_PATCH_AUTO_APPLY_ABORT = ALARM_GROUP_SW_MGMT + ".117"
FM_LOG_ID_SW_PATCH_AUTO_APPLY_ABORTING = ALARM_GROUP_SW_MGMT + ".118"
FM_LOG_ID_SW_PATCH_AUTO_APPLY_ABORT_REJECTED = ALARM_GROUP_SW_MGMT + ".119"
FM_LOG_ID_SW_PATCH_AUTO_APPLY_ABORT_FAILED = ALARM_GROUP_SW_MGMT + ".120"
FM_LOG_ID_SW_PATCH_AUTO_APPLY_ABORTED = ALARM_GROUP_SW_MGMT + ".121"
FM_ALARM_ID_SW_UPGRADE_AUTO_APPLY_INPROGRESS = ALARM_GROUP_SW_MGMT + ".201"
FM_ALARM_ID_SW_UPGRADE_AUTO_APPLY_ABORTING = ALARM_GROUP_SW_MGMT + ".202"
FM_ALARM_ID_SW_UPGRADE_AUTO_APPLY_FAILED = ALARM_GROUP_SW_MGMT + ".203"
FM_LOG_ID_SW_UPGRADE_AUTO_APPLY_START = ALARM_GROUP_SW_MGMT + ".211"
FM_LOG_ID_SW_UPGRADE_AUTO_APPLY_INPROGRESS = ALARM_GROUP_SW_MGMT + ".212"
FM_LOG_ID_SW_UPGRADE_AUTO_APPLY_REJECTED = ALARM_GROUP_SW_MGMT + ".213"
FM_LOG_ID_SW_UPGRADE_AUTO_APPLY_CANCELLED = ALARM_GROUP_SW_MGMT + ".214"
FM_LOG_ID_SW_UPGRADE_AUTO_APPLY_FAILED = ALARM_GROUP_SW_MGMT + ".215"
FM_LOG_ID_SW_UPGRADE_AUTO_APPLY_COMPLETED = ALARM_GROUP_SW_MGMT + ".216"
FM_LOG_ID_SW_UPGRADE_AUTO_APPLY_ABORT = ALARM_GROUP_SW_MGMT + ".217"
FM_LOG_ID_SW_UPGRADE_AUTO_APPLY_ABORTING = ALARM_GROUP_SW_MGMT + ".218"
FM_LOG_ID_SW_UPGRADE_AUTO_APPLY_ABORT_REJECTED = ALARM_GROUP_SW_MGMT + ".219"
FM_LOG_ID_SW_UPGRADE_AUTO_APPLY_ABORT_FAILED = ALARM_GROUP_SW_MGMT + ".220"
FM_LOG_ID_SW_UPGRADE_AUTO_APPLY_ABORTED = ALARM_GROUP_SW_MGMT + ".221"
FM_ALARM_STATE_SET = 'set'
FM_ALARM_STATE_CLEAR = 'clear'
FM_ALARM_STATE_MSG = 'msg'
FM_ALARM_TYPE_0 = 'other'
FM_ALARM_TYPE_1 = 'communication'
FM_ALARM_TYPE_2 = 'qos'
FM_ALARM_TYPE_3 = 'processing-error'
FM_ALARM_TYPE_4 = 'equipment'
FM_ALARM_TYPE_5 = 'environmental'
FM_ALARM_TYPE_6 = 'integrity-violation'
FM_ALARM_TYPE_7 = 'operational-violation'
FM_ALARM_TYPE_8 = 'physical-violation'
FM_ALARM_TYPE_9 = 'security-service-or-mechanism-violation'
FM_ALARM_TYPE_10 = 'time-domain-violation'
FM_ALARM_SEVERITY_CLEAR = 'clear'
FM_ALARM_SEVERITY_WARNING = 'warning'
FM_ALARM_SEVERITY_MINOR = 'minor'
FM_ALARM_SEVERITY_MAJOR = 'major'
FM_ALARM_SEVERITY_CRITICAL = 'critical'
FM_ALARM_OK_STATUS = "OK"
FM_ALARM_DEGRADED_STATUS = "degraded"
FM_ALARM_CRITICAL_STATUS = "critical"
ALARM_CRITICAL_REPLICATION = 'Potential data loss. No available OSDs in storage replication group '
ALARM_MAJOR_REPLICATION = 'Loss of replication in replication group '
ALARM_PROBABLE_CAUSE_1 = 'adaptor-error'
ALARM_PROBABLE_CAUSE_2 = 'application-subsystem-failure'
ALARM_PROBABLE_CAUSE_3 = 'bandwidth-reduced'
ALARM_PROBABLE_CAUSE_4 = 'call-establishment-error'
ALARM_PROBABLE_CAUSE_5 = 'communication-protocol-error'
ALARM_PROBABLE_CAUSE_6 = 'communication-subsystem-failure'
ALARM_PROBABLE_CAUSE_7 = 'configuration-or-customization-error'
ALARM_PROBABLE_CAUSE_8 = 'congestion'
ALARM_PROBABLE_CAUSE_9 = 'corrupt-data'
ALARM_PROBABLE_CAUSE_10 = 'cpu-cycles-limit-exceeded'
ALARM_PROBABLE_CAUSE_11 = 'dataset-or-modem-error'
ALARM_PROBABLE_CAUSE_12 = 'degraded-signal'
ALARM_PROBABLE_CAUSE_13 = 'dte-dce-interface-error'
ALARM_PROBABLE_CAUSE_14 = 'enclosure-door-open'
ALARM_PROBABLE_CAUSE_15 = 'equipment-malfunction'
ALARM_PROBABLE_CAUSE_16 = 'excessive-vibration'
ALARM_PROBABLE_CAUSE_17 = 'file-error'
ALARM_PROBABLE_CAUSE_18 = 'fire-detected'
ALARM_PROBABLE_CAUSE_19 = 'flood-detected'
ALARM_PROBABLE_CAUSE_20 = 'framing-error'
ALARM_PROBABLE_CAUSE_21 = 'heating-ventilation-cooling-system-problem'
ALARM_PROBABLE_CAUSE_22 = 'humidity-unacceptable'
ALARM_PROBABLE_CAUSE_23 = 'io-device-error'
ALARM_PROBABLE_CAUSE_24 = 'input-device-error'
ALARM_PROBABLE_CAUSE_25 = 'lan-error'
ALARM_PROBABLE_CAUSE_26 = 'leak-detected'
ALARM_PROBABLE_CAUSE_27 = 'local-node-transmission-error'
ALARM_PROBABLE_CAUSE_28 = 'loss-of-frame'
ALARM_PROBABLE_CAUSE_29 = 'loss-of-signal'
ALARM_PROBABLE_CAUSE_30 = 'material-supply-exhausted'
ALARM_PROBABLE_CAUSE_31 = 'multiplexer-problem'
ALARM_PROBABLE_CAUSE_32 = 'out-of-memory'
ALARM_PROBABLE_CAUSE_33 = 'output-device-error'
ALARM_PROBABLE_CAUSE_34 = 'performance-degraded'
ALARM_PROBABLE_CAUSE_35 = 'power-problem'
ALARM_PROBABLE_CAUSE_36 = 'processor-problem'
ALARM_PROBABLE_CAUSE_37 = 'pump-failure'
ALARM_PROBABLE_CAUSE_38 = 'queue-size-exceeded'
ALARM_PROBABLE_CAUSE_39 = 'receive-failure'
ALARM_PROBABLE_CAUSE_40 = 'receiver-failure'
ALARM_PROBABLE_CAUSE_41 = 'remote-node-transmission-error'
ALARM_PROBABLE_CAUSE_42 = 'resource-at-or-nearing-capacity'
ALARM_PROBABLE_CAUSE_43 = 'response-time-excessive'
ALARM_PROBABLE_CAUSE_44 = 'retransmission-rate-excessive'
ALARM_PROBABLE_CAUSE_45 = 'software-error'
ALARM_PROBABLE_CAUSE_46 = 'software-program-abnormally-terminated'
ALARM_PROBABLE_CAUSE_47 = 'software-program-error'
ALARM_PROBABLE_CAUSE_48 = 'storage-capacity-problem'
ALARM_PROBABLE_CAUSE_49 = 'temperature-unacceptable'
ALARM_PROBABLE_CAUSE_50 = 'threshold-crossed'
ALARM_PROBABLE_CAUSE_51 = 'timing-problem'
ALARM_PROBABLE_CAUSE_52 = 'toxic-leak-detected'
ALARM_PROBABLE_CAUSE_53 = 'transmit-failure'
ALARM_PROBABLE_CAUSE_54 = 'transmitter-failure'
ALARM_PROBABLE_CAUSE_55 = 'underlying-resource-unavailable'
ALARM_PROBABLE_CAUSE_56 = 'version-mismatch'
ALARM_PROBABLE_CAUSE_57 = 'duplicate-information'
ALARM_PROBABLE_CAUSE_58 = 'information-missing'
ALARM_PROBABLE_CAUSE_59 = 'information-modification-detected'
ALARM_PROBABLE_CAUSE_60 = 'information-out-of-sequence'
ALARM_PROBABLE_CAUSE_61 = 'unexpected-information'
ALARM_PROBABLE_CAUSE_62 = 'denial-of-service'
ALARM_PROBABLE_CAUSE_63 = 'out-of-service'
ALARM_PROBABLE_CAUSE_64 = 'procedural-error'
ALARM_PROBABLE_CAUSE_65 = 'unspecified-reason'
ALARM_PROBABLE_CAUSE_66 = 'cable-tamper'
ALARM_PROBABLE_CAUSE_67 = 'intrusion-detection'
ALARM_PROBABLE_CAUSE_68 = 'authentication-failure'
ALARM_PROBABLE_CAUSE_69 = 'breach-of-confidentiality'
ALARM_PROBABLE_CAUSE_70 = 'non-repudiation-failure'
ALARM_PROBABLE_CAUSE_71 = 'unauthorized-access-attempt'
ALARM_PROBABLE_CAUSE_72 = 'delayed-information'
ALARM_PROBABLE_CAUSE_73 = 'key-expired'
ALARM_PROBABLE_CAUSE_74 = 'out-of-hours-activity'
ALARM_PROBABLE_CAUSE_75 = 'configuration-out-of-date'
ALARM_PROBABLE_CAUSE_76 = 'configuration-provisioning-required'
ALARM_PROBABLE_CAUSE_UNKNOWN = 'unknown'
ALARM_STATE = [FM_ALARM_STATE_SET, FM_ALARM_STATE_CLEAR, FM_ALARM_STATE_MSG]
ALARM_TYPE = [FM_ALARM_TYPE_0, FM_ALARM_TYPE_1, FM_ALARM_TYPE_2,
FM_ALARM_TYPE_3, FM_ALARM_TYPE_4, FM_ALARM_TYPE_5,
FM_ALARM_TYPE_6, FM_ALARM_TYPE_7, FM_ALARM_TYPE_8,
FM_ALARM_TYPE_9, FM_ALARM_TYPE_10]
ALARM_SEVERITY = [FM_ALARM_SEVERITY_CLEAR, FM_ALARM_SEVERITY_WARNING,
FM_ALARM_SEVERITY_MINOR, FM_ALARM_SEVERITY_MAJOR,
FM_ALARM_SEVERITY_CRITICAL]
ALARM_STATUS = [FM_ALARM_OK_STATUS, FM_ALARM_DEGRADED_STATUS,
FM_ALARM_CRITICAL_STATUS]
ALARM_PROBABLE_CAUSE = [ALARM_PROBABLE_CAUSE_1, ALARM_PROBABLE_CAUSE_2,
ALARM_PROBABLE_CAUSE_3, ALARM_PROBABLE_CAUSE_4,
ALARM_PROBABLE_CAUSE_5, ALARM_PROBABLE_CAUSE_6,
ALARM_PROBABLE_CAUSE_7, ALARM_PROBABLE_CAUSE_8,
ALARM_PROBABLE_CAUSE_9, ALARM_PROBABLE_CAUSE_10,
ALARM_PROBABLE_CAUSE_11, ALARM_PROBABLE_CAUSE_12,
ALARM_PROBABLE_CAUSE_13, ALARM_PROBABLE_CAUSE_14,
ALARM_PROBABLE_CAUSE_15, ALARM_PROBABLE_CAUSE_16,
ALARM_PROBABLE_CAUSE_17, ALARM_PROBABLE_CAUSE_18,
ALARM_PROBABLE_CAUSE_19, ALARM_PROBABLE_CAUSE_20,
ALARM_PROBABLE_CAUSE_21, ALARM_PROBABLE_CAUSE_22,
ALARM_PROBABLE_CAUSE_23, ALARM_PROBABLE_CAUSE_24,
ALARM_PROBABLE_CAUSE_25, ALARM_PROBABLE_CAUSE_26,
ALARM_PROBABLE_CAUSE_27, ALARM_PROBABLE_CAUSE_28,
ALARM_PROBABLE_CAUSE_29, ALARM_PROBABLE_CAUSE_30,
ALARM_PROBABLE_CAUSE_31, ALARM_PROBABLE_CAUSE_32,
ALARM_PROBABLE_CAUSE_33, ALARM_PROBABLE_CAUSE_34,
ALARM_PROBABLE_CAUSE_35, ALARM_PROBABLE_CAUSE_36,
ALARM_PROBABLE_CAUSE_37, ALARM_PROBABLE_CAUSE_38,
ALARM_PROBABLE_CAUSE_39, ALARM_PROBABLE_CAUSE_40,
ALARM_PROBABLE_CAUSE_41, ALARM_PROBABLE_CAUSE_42,
ALARM_PROBABLE_CAUSE_43, ALARM_PROBABLE_CAUSE_44,
ALARM_PROBABLE_CAUSE_45, ALARM_PROBABLE_CAUSE_46,
ALARM_PROBABLE_CAUSE_47, ALARM_PROBABLE_CAUSE_48,
ALARM_PROBABLE_CAUSE_49, ALARM_PROBABLE_CAUSE_50,
ALARM_PROBABLE_CAUSE_51, ALARM_PROBABLE_CAUSE_52,
ALARM_PROBABLE_CAUSE_53, ALARM_PROBABLE_CAUSE_54,
ALARM_PROBABLE_CAUSE_55, ALARM_PROBABLE_CAUSE_56,
ALARM_PROBABLE_CAUSE_57, ALARM_PROBABLE_CAUSE_58,
ALARM_PROBABLE_CAUSE_59, ALARM_PROBABLE_CAUSE_60,
ALARM_PROBABLE_CAUSE_61, ALARM_PROBABLE_CAUSE_62,
ALARM_PROBABLE_CAUSE_63, ALARM_PROBABLE_CAUSE_64,
ALARM_PROBABLE_CAUSE_65, ALARM_PROBABLE_CAUSE_66,
ALARM_PROBABLE_CAUSE_67, ALARM_PROBABLE_CAUSE_68,
ALARM_PROBABLE_CAUSE_69, ALARM_PROBABLE_CAUSE_70,
ALARM_PROBABLE_CAUSE_71, ALARM_PROBABLE_CAUSE_72,
ALARM_PROBABLE_CAUSE_73, ALARM_PROBABLE_CAUSE_74,
ALARM_PROBABLE_CAUSE_75, ALARM_PROBABLE_CAUSE_76,
ALARM_PROBABLE_CAUSE_UNKNOWN]
FM_CLIENT_SET_FAULT = "/usr/local/bin/fmClientCli -c "
FM_CLIENT_CLEAR_FAULT = "/usr/local/bin/fmClientCli -d "
FM_CLIENT_GET_FAULT = "/usr/local/bin/fmClientCli -g "
FM_CLIENT_GET_FAULTS = "/usr/local/bin/fmClientCli -G "
FM_CLIENT_GET_FAULTS_BY_ID = "/usr/local/bin/fmClientCli -A "
FM_CLIENT_CLEAR_ALL = "/usr/local/bin/fmClientCli -D "
FM_CLIENT_STR_SEP = "###"
FM_UUID_INDEX = 0
FM_ALARM_ID_INDEX = 1
FM_ALARM_STATE_INDEX = 2
FM_ENT_TYPE_ID_INDEX = 3
FM_ENT_INST_ID_INDEX = 4
FM_TIMESTAMP_INDEX = 5
FM_SEVERITY_INDEX = 6
FM_REASON_TEXT_INDEX = 7
FM_ALARM_TYPE_INDEX = 8
FM_CAUSE_INDEX = 9
FM_REPAIR_ACTION_INDEX = 10
FM_SERVICE_AFFECTING_INDEX = 11
FM_SUPPRESSION_INDEX = 12
FM_INHIBIT_ALARMS_INDEX = 13
MAX_ALARM_ATTRIBUTES = 14

+ 247
- 0
fm-api/fm_api/fm_api.py View File

@ -0,0 +1,247 @@
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- encoding: utf-8 -*-
#
#
# Author:
#
import copy
import subprocess
import constants
import six
class ClientException(Exception):
pass
# Fields explanation:
#
# alarm_id: a text string of the alarm identifier
# alarm_state: see ALARM_STATE
# entity_type_id: type of the object raising alarm.
# entity_instance_id: instance information of the object raising alarm.
# severity: see ALARM_SEVERITY
# reason_text: free-format string providing description and additional details
# on the alarm. Optional.
# alarm_type: see ALARM_TYPE
# probable_cause: see ALARM_PROBABLE_CAUSE
# proposed_repair_action:free-format string providing additional details on how to
# clear the alarm. Optional.
# service_affecting: true/false, default to false
# suppression: true/false (allowed/not-allowed), default to false
# uuid: unique identifier of an active alarm instance, filled by FM system
# Timestamp: when the alarm has been raised/updated, filled by FM system
# See CGCS FM Guide for the alarm model specification
class Fault(object):
def __init__(self, alarm_id, alarm_state, entity_type_id,
entity_instance_id, severity, reason_text,
alarm_type, probable_cause, proposed_repair_action,
service_affecting=False, suppression=False,
uuid=None, timestamp=None):
self.alarm_id = alarm_id
self.alarm_state = alarm_state
self.entity_type_id = self._unicode(entity_type_id)
self.entity_instance_id = self._unicode(entity_instance_id)
self.severity = severity
self.reason_text = self._unicode(reason_text)
self.alarm_type = alarm_type
self.probable_cause = probable_cause
self.proposed_repair_action = self._unicode(proposed_repair_action)
self.service_affecting = service_affecting
self.suppression = suppression
self.uuid = uuid
self.timestamp = timestamp
def as_dict(self):
return copy.copy(self.__dict__)
@staticmethod
def _unicode(value):
if isinstance(value, str):
return six.text_type(value.decode('utf-8'))
else:
return value
class FaultAPIs(object):
def set_fault(self, data):
self._check_required_attributes(data)
self._validate_attributes(data)
buff = self._alarm_to_str(data)
cmd = constants.FM_CLIENT_SET_FAULT + '"' + buff + '"'
resp = self._run_cmd_and_get_resp(cmd)
if (resp[0] == "Ok") and (len(resp) > 1):
return resp[1]
else:
return None
def clear_fault(self, alarm_id, entity_instance_id):
sep = constants.FM_CLIENT_STR_SEP
buff = (sep + self._check_val(alarm_id) + sep +
self._check_val(entity_instance_id) + sep)
cmd = constants.FM_CLIENT_CLEAR_FAULT + '"' + buff + '"'
resp = self._run_cmd_and_get_resp(cmd)
if resp[0] == "Ok":
return True
else:
return False
def get_fault(self, alarm_id, entity_instance_id):
sep = constants.FM_CLIENT_STR_SEP
buff = (sep + self._check_val(alarm_id) + sep +
self._check_val(entity_instance_id) + sep)
cmd = constants.FM_CLIENT_GET_FAULT + '"' + buff + '"'
resp = self._run_cmd_and_get_resp(cmd)
if (resp[0] == "Ok") and (len(resp) > 1):
return self._str_to_alarm(resp[1])
else:
return None
def clear_all(self, entity_instance_id):
cmd = constants.FM_CLIENT_CLEAR_ALL + '"' + entity_instance_id + '"'
resp = self._run_cmd_and_get_resp(cmd)
if resp[0] == "Ok":
return True
else:
return False
def get_faults(self, entity_instance_id):
cmd = constants.FM_CLIENT_GET_FAULTS + '"' + entity_instance_id + '"'
resp = self._run_cmd_and_get_resp(cmd)
data = []
if resp[0] == "Ok":
for i in range(1, len(resp)):
alarm = self._str_to_alarm(resp[i])
data.append(alarm)
return data
else:
return None
def get_faults_by_id(self, alarm_id):
cmd = constants.FM_CLIENT_GET_FAULTS_BY_ID + '"' + alarm_id + '"'
resp = self._run_cmd_and_get_resp(cmd)
data = []
if resp[0] == "Ok":
for i in range(1, len(resp)):
alarm = self._str_to_alarm(resp[i])
data.append(alarm)
return data
else:
return None
@staticmethod
def _check_val(data):
if data is None:
return " "
else:
return data
def _alarm_to_str(self, data):
sep = constants.FM_CLIENT_STR_SEP
return (sep + self._check_val(data.uuid) + sep + data.alarm_id + sep +
data.alarm_state + sep + data.entity_type_id + sep +
data.entity_instance_id + sep + self._check_val(data.timestamp)
+ sep + data.severity + sep + self._check_val(data.reason_text)
+ sep + data.alarm_type + sep + data.probable_cause + sep +
self._check_val(data.proposed_repair_action) + sep +
str(data.service_affecting) + sep + str(data.suppression) + sep)
@staticmethod
def _str_to_alarm(alarm_str):
l = alarm_str.split(constants.FM_CLIENT_STR_SEP)
if len(l) < constants.MAX_ALARM_ATTRIBUTES:
return None
else:
data = Fault(l[constants.FM_ALARM_ID_INDEX],
l[constants.FM_ALARM_STATE_INDEX],
l[constants.FM_ENT_TYPE_ID_INDEX],
l[constants.FM_ENT_INST_ID_INDEX],
l[constants.FM_SEVERITY_INDEX],
l[constants.FM_REASON_TEXT_INDEX],
l[constants.FM_ALARM_TYPE_INDEX],
l[constants.FM_CAUSE_INDEX],
l[constants.FM_REPAIR_ACTION_INDEX],
l[constants.FM_SERVICE_AFFECTING_INDEX],
l[constants.FM_SUPPRESSION_INDEX],
l[constants.FM_UUID_INDEX],
l[constants.FM_TIMESTAMP_INDEX])
return data
@staticmethod
def _run_cmd_and_get_resp(cmd):
resp = []
cmd = cmd.encode('utf-8')
pro = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE)
output = pro.communicate()[0]
lines = output.split('\n')
for line in lines:
if line != '':
resp.append(line)
if len(resp) == 0:
resp.append("Unknown")
return resp
@staticmethod
def _check_required_attributes(data):
if data.alarm_id is None:
raise ClientException("Alarm id is is required.")
if data.alarm_state is None:
raise ClientException("Alarm state is required.")
if data.severity is None:
raise ClientException("Severity is required.")
if data.alarm_type is None:
raise ClientException("Alarm type is required.")
if data.probable_cause is None:
raise ClientException("Probable Cause is required.")
if data.entity_type_id is None:
raise ClientException("Entity type id is required.")
if data.entity_instance_id is None:
raise ClientException("Entity instance id is required.")
@staticmethod
def _validate_attributes(data):
""" Validate the attributes
only applies to Telco specific attributes"""
if data.alarm_state not in constants.ALARM_STATE:
raise ClientException("Invalid Fault State: %s" %
data.alarm_state)
if data.severity not in constants.ALARM_SEVERITY:
raise ClientException("Invalid Fault Severity: %s" %
data.severity)
if data.alarm_type not in constants.ALARM_TYPE:
raise ClientException("Invalid Fault Type: %s" %
data.alarm_type)
if data.probable_cause not in constants.ALARM_PROBABLE_CAUSE:
raise ClientException("Invalid Fault Probable Cause: %s" %
data.probable_cause)
@staticmethod
def alarm_allowed(alarm_severity, threshold):
def severity_to_int(severity):
if severity == 'none':
return 5
elif severity == constants.FM_ALARM_SEVERITY_CRITICAL:
return 4
elif severity == constants.FM_ALARM_SEVERITY_MAJOR:
return 3
elif severity == constants.FM_ALARM_SEVERITY_MINOR:
return 2
elif severity == constants.FM_ALARM_SEVERITY_WARNING:
return 1
given = severity_to_int(alarm_severity)
threshold = severity_to_int(threshold)
if given < threshold:
return True
return False

+ 105
- 0
fm-api/fm_api_test.py View File

@ -0,0 +1,105 @@
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2014 Wind River Systems, Inc.
#
# Author:
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import sys
from fm_api import *
from fm_api import constants
def print_alarm(alarm):
alarm_str = "alarm_id: " + alarm.alarm_id + ", " + "uuid: " + alarm.uuid + ", "
alarm_str += "alarm_type: " + alarm.alarm_type + "\n"
alarm_str += "state: " + alarm.alarm_state + ", ""severity: " + alarm.severity + ", " \
+ "entity_type_id: " + alarm.entity_type_id + ", timestamp: "+ alarm.timestamp + "\n"
alarm_str += "entity_instance_id: " + alarm.entity_instance_id + ", "
alarm_str += "probable cause:" + alarm.probable_cause + "\n"
print alarm_str
def create():
ser = FaultAPIs()
fault = Fault(alarm_id=constants.FM_ALARM_ID_VM_RESCUED,
alarm_state=constants.FM_ALARM_STATE_SET,
entity_type_id=constants.FM_ENTITY_TYPE_INSTANCE,
entity_instance_id=constants.FM_ENTITY_TYPE_INSTANCE + '=' + 'a4e4cdb7-2ee6-4818-84c8-5310fcd67b5d',
severity = constants.FM_ALARM_SEVERITY_CRITICAL,
reason_text = "Unknown",
alarm_type = constants.FM_ALARM_TYPE_5,
probable_cause = constants.ALARM_PROBABLE_CAUSE_8,
proposed_repair_action = None,
service_affecting = False,
suppression = False)
uuid =ser.set_fault(fault)
print uuid
def delete(alarm_id, instance_id):
ser=FaultAPIs()
ret = ser.clear_fault(alarm_id,instance_id)
print "Delete fault return %s" % str(ret)
def del_all(instance_id):
ser=FaultAPIs()
ret= ser.clear_all(instance_id)
print "Delete faults return: %s" % str(ret)
def get(alarm_id, instance_id):
ser=FaultAPIs()
a = ser.get_fault(alarm_id, instance_id)
if a is not None:
print_alarm(a)
else:
print "Alarm not found"
def get_all(instance_id):
ser=FaultAPIs()
ll= ser.get_faults(instance_id)
if ll is not None:
print "Total alarm returned: %d\n" % len(ll)
for i in ll:
print_alarm(i)
else:
print "No alarm returned"
def get_list(alarm_id):
ser=FaultAPIs()
ll= ser.get_faults_by_id(alarm_id)
if ll is not None:
print "Total alarm returned: %d\n" % len(ll)
for i in ll:
print_alarm(i)
else:
print "No alarm returned"
if __name__ == "__main__":
if sys.argv[1] == "create":
sys.exit(create())
elif sys.argv[1] == "del":
sys.exit(delete(sys.argv[2],sys.argv[3]))
elif sys.argv[1] == "get":
sys.exit(get(sys.argv[2],sys.argv[3]))
elif sys.argv[1] == "get_all":
sys.exit(get_all(sys.argv[2]))
elif sys.argv[1] == "del_all":
sys.exit(del_all(sys.argv[2]))
elif sys.argv[1] == "get_list":
sys.exit(get_list(sys.argv[2]))

+ 17
- 0
fm-api/setup.py View File

@ -0,0 +1,17 @@
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import setuptools
setuptools.setup(
name='fm_api',
description='CGCS FM Python API',
version='1.0.0',
license='Apache-2.0',
packages=['fm_api'],
entry_points={
}
)

+ 6
- 0
fm-common/.gitignore View File

@ -0,0 +1,6 @@
!.distro
.distro/centos7/rpmbuild/RPMS
.distro/centos7/rpmbuild/SRPMS
.distro/centos7/rpmbuild/BUILD
.distro/centos7/rpmbuild/BUILDROOT
.distro/centos7/rpmbuild/SOURCES/fm-common*tar.gz

+ 14
- 0
fm-common/PKG-INFO View File

@ -0,0 +1,14 @@
Metadata-Version: 1.1
Name: fm-common
Version: 1.0
Summary: Titanium Cloud Platform Fault Management Common Package
Home-page:
Author: Windriver
Author-email: info@windriver.com
License: Apache-2.0
Description: CGTS platform Fault Management Client Library that provides APIs
for applications to raise/clear/update active alarms."
Platform: UNKNOWN

+ 2
- 0
fm-common/centos/build_srpm.data View File

@ -0,0 +1,2 @@
SRC_DIR="sources"
TIS_PATCH_VER=8

+ 85
- 0
fm-common/centos/fm-common.spec View File

@ -0,0 +1,85 @@
%define local_dir /usr/local
%define local_bindir %{local_dir}/bin
%define cgcs_doc_deploy_dir /opt/deploy/cgcs_doc
Summary: CGTS Platform Fault Management Common Package
Name: fm-common
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: %{name}-%{version}.tar.gz
BuildRequires: util-linux
BuildRequires: postgresql-devel
BuildRequires: libuuid-devel
BuildRequires: python-devel
%package -n fm-common-dev
Summary: CGTS Platform Fault Management Common Package - Development files
Group: devel
Requires: fm-common = %{version}-%{release}
%description
Titanium Cloud platform Fault Management Client Library that provides APIs for
applications to raise/clear/update active alarms.
%description -n fm-common-dev
Titanium Cloud platform Fault Management Client Library that provides APIs for
applications to raise/clear/update active alarms. This package contains
symbolic links, header files, and related items necessary for software
development.
%package -n fm-common-doc
Summary: fm-common deploy doc
Group: doc
%description -n fm-common-doc
Contains fmAlarm.h which is to be used by fm-doc package to validate
the Alarms & Logs Doc Yaml file
%prep
%setup
%build
VER=%{version}
MAJOR=`echo $VER | awk -F . '{print $1}'`
MINOR=`echo $VER | awk -F . '{print $2}'`
make MAJOR=$MAJOR MINOR=$MINOR %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
VER=%{version}
MAJOR=`echo $VER | awk -F . '{print $1}'`
MINOR=`echo $VER | awk -F . '{print $2}'`
make DEST_DIR=$RPM_BUILD_ROOT BIN_DIR=%{local_bindir} LIB_DIR=%{_libdir} INC_DIR=%{_includedir} MAJOR=$MAJOR MINOR=$MINOR install_non_bb
install -d $RPM_BUILD_ROOT/usr/bin
install -m 755 fm_db_sync_event_suppression.py $RPM_BUILD_ROOT/usr/bin/fm_db_sync_event_suppression.py
CGCS_DOC_DEPLOY=$RPM_BUILD_ROOT/%{cgcs_doc_deploy_dir}
install -d $CGCS_DOC_DEPLOY
# install fmAlarm.h in CGCS_DOC_DEPLOY_DIR
# used by fm-doc package to validate the Alarms & Logs Doc Yaml file
install -m 644 fmAlarm.h $CGCS_DOC_DEPLOY
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc LICENSE
%{local_bindir}/*
%{_libdir}/*.so.*
/usr/bin/fm_db_sync_event_suppression.py
%files -n fm-common-dev
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/*.so
%files -n fm-common-doc
%defattr(-,root,root,-)
%{cgcs_doc_deploy_dir}/*

+ 202
- 0
fm-common/sources/LICENSE View File

@ -0,0 +1,202 @@
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.