Initial commit of broadview-lib
Change-Id: I4db5ebce4c92c044f55e3714d840dc2fc7ba314b
This commit is contained in:
parent
57b39f04f9
commit
38a9595f7f
17
CONTRIBUTING.rst
Normal file
17
CONTRIBUTING.rst
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
If you would like to contribute to the development of OpenStack, you must
|
||||||
|
follow the steps in this page:
|
||||||
|
|
||||||
|
http://docs.openstack.org/infra/manual/developers.html
|
||||||
|
|
||||||
|
If you already have a good understanding of how the system works and your
|
||||||
|
OpenStack accounts are set up, you can skip to the development workflow
|
||||||
|
section of this documentation to learn how changes to OpenStack should be
|
||||||
|
submitted for review via the Gerrit tool:
|
||||||
|
|
||||||
|
http://docs.openstack.org/infra/manual/developers.html#development-workflow
|
||||||
|
|
||||||
|
Pull requests submitted through GitHub will be ignored.
|
||||||
|
|
||||||
|
Bugs should be filed on Launchpad, not GitHub:
|
||||||
|
|
||||||
|
https://bugs.launchpad.net/broadview-lib
|
4
HACKING.rst
Normal file
4
HACKING.rst
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
broadview-lib Style Commandments
|
||||||
|
===============================================
|
||||||
|
|
||||||
|
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/
|
175
LICENSE
Normal file
175
LICENSE
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
|
||||||
|
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.
|
6
MANIFEST.in
Normal file
6
MANIFEST.in
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
include AUTHORS
|
||||||
|
include ChangeLog
|
||||||
|
exclude .gitignore
|
||||||
|
exclude .gitreview
|
||||||
|
|
||||||
|
global-exclude *.pyc
|
176
README.rst
Normal file
176
README.rst
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
# Overview
|
||||||
|
|
||||||
|
`broadview-lib` is a library that provides an interface to Broadcom's
|
||||||
|
BroadView instrumentation functionality.
|
||||||
|
|
||||||
|
## What is BroadView?
|
||||||
|
|
||||||
|
BroadView is an open source software suite that enables advanced analytics in
|
||||||
|
next-generation networks. Troubleshooting network problems and ensuring
|
||||||
|
application SLAs are very complex tasks. In cloud networks, overlay
|
||||||
|
technologies reduce visibility into packet flows, thereby making it even more
|
||||||
|
difficult to analyze issues and ensure SLAs. OpenStack projects such as
|
||||||
|
Monasca provide monitoring-as-a-service to deliver usage metrics from
|
||||||
|
applications and tenant networks; however, underlay monitoring is not
|
||||||
|
supported. Ensuring application SLAs requires overlay mapping to the underlay,
|
||||||
|
and optimal performance of underlay infrastructure is essential.
|
||||||
|
|
||||||
|
BroadView-based solutions enable programmable access to underlay monitoring,
|
||||||
|
facilitating applications to gather advanced analytics in a highly scalable
|
||||||
|
manner.
|
||||||
|
|
||||||
|
Buffer Statistics Tracking (BST) is one of the most important features for
|
||||||
|
enabling rich congestion analytics. Network Traffic is bursty by nature and
|
||||||
|
microbursts occur when there is transient congestion. Microbursts are difficult
|
||||||
|
to detect using traditional port drop counts. Broadcom silicon provides the
|
||||||
|
ability to monitor MMU buffer utilization counts as part of the BST feature.
|
||||||
|
It provides network administrators and applications improved telemetry on
|
||||||
|
the usage of various ingress and egress buffers, without disrupting regular
|
||||||
|
packet forwarding operations. There are thousands of counters available across
|
||||||
|
various ports, port groups, and service pools that can be utilized by the
|
||||||
|
applications for instantaneous monitoring in a scalable way. BST tracks
|
||||||
|
ingress-, egress-, and device-based use-counts for both unicast and multicast
|
||||||
|
flows. The actual use-counts vary depending on the chip set.
|
||||||
|
|
||||||
|
More information on BroadView, BST, and what they provide can be found at:
|
||||||
|
|
||||||
|
Code and documentation: https://github.com/Broadcom-Switch/BroadView-Instrumentation
|
||||||
|
Product information: https://www.broadcom.com/products/ethernet-communication-and-switching/switching/broadview
|
||||||
|
|
||||||
|
## BroadView Agent and broadview-lib
|
||||||
|
|
||||||
|
A BroadView agent is software running on platforms that support BroadView. It
|
||||||
|
exposes a JSON-RPC, REST-like API for configuring the agent to report statistics
|
||||||
|
such a BST. It also report statistics to agents or collectors that are designed
|
||||||
|
to receive these reports. These reports are also transmitted using JSON-RPC.
|
||||||
|
All connections to and from the agent are based on HTTP 1.1.
|
||||||
|
|
||||||
|
broadview-lib is designed to provide the underlying infrastructure that is
|
||||||
|
needed for the development of Python applications that interact with a
|
||||||
|
BroadView agent. Using broadview-lib, a Python application can configure a
|
||||||
|
BroadView agent and make calls on the agent to perform various tasks.
|
||||||
|
broadview-lib also provides classes that can parse notifications and data sent
|
||||||
|
to an application by a BroadView agent. broadview-lib can be thought of as
|
||||||
|
presenting an object-model above the JSON-RPC protocol of the BroadView agent.
|
||||||
|
|
||||||
|
As such, broadview-lib forms the basis of other contributions that integrate
|
||||||
|
BroadView functionality into OpenStack, and represents an OpenStack-neutral
|
||||||
|
view of BroadView's API. The library can be used by other projects outside of
|
||||||
|
OpenStack, if desired.
|
||||||
|
|
||||||
|
broadview-lib consists of two components. One is a set of classes that can
|
||||||
|
be used to configure BroadView. The other is an API that parses content
|
||||||
|
sent by BroadView agents and presents it as Python objects.
|
||||||
|
|
||||||
|
broadview-lib is, like BroadView itself, designed to be extensible. In this
|
||||||
|
release, the BroadView BST component is supported. Future releases will add
|
||||||
|
support for additional BroadView components as they become available.
|
||||||
|
|
||||||
|
# Tools
|
||||||
|
|
||||||
|
broadview-lib includes bv-bstctl.py, which is a command line application that
|
||||||
|
can be used to configure BroadView BST. It also provides an example usage of
|
||||||
|
both the configuration and BST parsing APIs in broadview-lib. For usage
|
||||||
|
information, please type:
|
||||||
|
|
||||||
|
python bv-bstcfg.py help
|
||||||
|
|
||||||
|
|
||||||
|
bv-bstctl.py writes its output to stdout in JSON format.
|
||||||
|
|
||||||
|
The file examples.sh in the tools directory contains usage example for the
|
||||||
|
bv-bstcfg application and can be used to exercise bv-bsctl.
|
||||||
|
|
||||||
|
# Classes
|
||||||
|
|
||||||
|
The following describes the major classes in the library.
|
||||||
|
|
||||||
|
## BST Configuration and Data Gathering
|
||||||
|
|
||||||
|
The bst.py file in config contains various configuration and data gathering
|
||||||
|
classes.
|
||||||
|
|
||||||
|
The following briefly summarizes these classes. For example usage, see the
|
||||||
|
unit test code in bst.py, or the bv-bstctl.py application.
|
||||||
|
|
||||||
|
### ConfigureBSTFeature
|
||||||
|
|
||||||
|
This class can be used to provide general configuration of the BroadView BST
|
||||||
|
component.
|
||||||
|
|
||||||
|
### ConfigureBSTTracking
|
||||||
|
|
||||||
|
This class is used to enable or disable the tracking of various BST statistics.
|
||||||
|
|
||||||
|
### ConfigureBSTThresholds
|
||||||
|
|
||||||
|
This base class is inherited by the several subclasses, each which allow for
|
||||||
|
the configuration of thresholds for the various statistics (realms) that
|
||||||
|
are supported by BST. The following is a list of these subclasses, one for
|
||||||
|
each supported BST realm:
|
||||||
|
|
||||||
|
device - ConfigureDeviceThreshold
|
||||||
|
egress-cpu-queue - ConfigureEgressCpuQueueThreshold
|
||||||
|
egress-rqe-queue - ConfigureEgressRqeQueueThreshold
|
||||||
|
egress-port-service-pool - ConfigureEgressPortServicePoolThreshold
|
||||||
|
egress-service-pool - ConfigureEgressServicePoolThreshold
|
||||||
|
egress-uc-queue - ConfigureEgressUcQueueThreshold
|
||||||
|
egress-uc-queue-group - ConfigureEgressUcQueueGroupThreshold
|
||||||
|
egress-mc-queue - ConfigureEgressMcQueueThreshold
|
||||||
|
ingress-port-priority-group - ConfigureIngressPortPriorityGroupThreshold
|
||||||
|
ingress-port-service-pool - ConfigureIngressPortServicePoolThreshold
|
||||||
|
ingress-service-pool - ConfigureIngressServicePoolThreshold
|
||||||
|
|
||||||
|
### ClearBSTStatistics
|
||||||
|
|
||||||
|
This class supports the resetting of all BST statistics in the agent.
|
||||||
|
|
||||||
|
### ClearBSTThresholds
|
||||||
|
|
||||||
|
This class supports the resetting of all BST thresholds in the agent.
|
||||||
|
|
||||||
|
### GetBSTFeature
|
||||||
|
|
||||||
|
This class reports the various settings of the BroadView BST component.
|
||||||
|
|
||||||
|
### GetBSTTracking
|
||||||
|
|
||||||
|
This class reports the tracking settings for the BroadView BST component.
|
||||||
|
The tracking status of each supported realm is reported.
|
||||||
|
|
||||||
|
### GetBSTThresholds
|
||||||
|
|
||||||
|
This class reports the threshold settings for the various BST realms.
|
||||||
|
|
||||||
|
### GetBSTReport
|
||||||
|
|
||||||
|
This class reports the current buffer statistics for the specified realms.
|
||||||
|
|
||||||
|
## BST Object
|
||||||
|
|
||||||
|
The class BSTParser (found in bst/bst_parser.py) accepts the JSON payload
|
||||||
|
that is sent by a BroadView agent for BST notifications and responses that
|
||||||
|
contain BST threshold reports.
|
||||||
|
|
||||||
|
## Unit tests
|
||||||
|
|
||||||
|
To ensure that broadview-lib is decoupled from any (and all) OpenStack
|
||||||
|
dependencies, unit tests are implemented by each of the individual Python
|
||||||
|
modules using the Python unittest framework.
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
(C) Copyright Broadcom Corporation 2016
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
19
broadview_lib/__init__.py
Normal file
19
broadview_lib/__init__.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
#import pbr.version
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#__version__ = pbr.version.VersionInfo(
|
||||||
|
# 'broadview_lib').version_string()
|
0
broadview_lib/bst/__init__.py
Normal file
0
broadview_lib/bst/__init__.py
Normal file
1271
broadview_lib/bst/bst_parser.py
Normal file
1271
broadview_lib/bst/bst_parser.py
Normal file
File diff suppressed because it is too large
Load Diff
25
broadview_lib/bst/cpubuffercount.py
Normal file
25
broadview_lib/bst/cpubuffercount.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class CPUBufferCount():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "cpu-buffer-count"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[1]
|
||||||
|
self.isPercent = False
|
||||||
|
|
25
broadview_lib/bst/cpuqueueentries.py
Normal file
25
broadview_lib/bst/cpuqueueentries.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class CPUQueueEntries():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "cpu-queue-entries"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[2]
|
||||||
|
self.isPercent = False
|
||||||
|
|
34
broadview_lib/bst/devicedata.py
Normal file
34
broadview_lib/bst/devicedata.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class DeviceData():
|
||||||
|
def __init__(self):
|
||||||
|
self.__value = None
|
||||||
|
self.__isPercent = False
|
||||||
|
|
||||||
|
def getValue(self):
|
||||||
|
return self.__value
|
||||||
|
|
||||||
|
def getIsPercent(self):
|
||||||
|
return self.__isPercent
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "device"
|
||||||
|
|
||||||
|
def parse(self, data, port=None):
|
||||||
|
self.__value = int(data)
|
||||||
|
# XXX how can we tell if this is a percentage?
|
||||||
|
self.__isPercent = False
|
||||||
|
|
||||||
|
|
59
broadview_lib/bst/egress_cpu_queue.py
Normal file
59
broadview_lib/bst/egress_cpu_queue.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 cpubuffercount
|
||||||
|
import cpuqueueentries
|
||||||
|
|
||||||
|
class EgressCPUQueueEntry():
|
||||||
|
def __init__(self):
|
||||||
|
self._queue = None
|
||||||
|
self._cpubuffercount = cpubuffercount.CPUBufferCount()
|
||||||
|
self._cpuqueueentries = cpuqueueentries.CPUQueueEntries()
|
||||||
|
|
||||||
|
def getQueue(self):
|
||||||
|
return self._queue
|
||||||
|
|
||||||
|
def getCPUBufferCount(self):
|
||||||
|
return self._cpubuffercount.value
|
||||||
|
|
||||||
|
def getCPUQueueEntries(self):
|
||||||
|
return self._cpuqueueentries.value
|
||||||
|
|
||||||
|
class EgressCPUQueue():
|
||||||
|
def __init__(self):
|
||||||
|
self.__table = []
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "egress-cpu-queue"
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
self.__n = 0
|
||||||
|
return self
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
if self.__n >= len(self.__table):
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
n = self.__n
|
||||||
|
self.__n += 1
|
||||||
|
return self.__table[n]
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
for x in data:
|
||||||
|
val = EgressCPUQueueEntry()
|
||||||
|
val._queue = x[0]
|
||||||
|
val._cpubuffercount.parse(x)
|
||||||
|
val._cpuqueueentries.parse(x)
|
||||||
|
self.__table.append(val)
|
||||||
|
|
65
broadview_lib/bst/egress_mc_queue.py
Normal file
65
broadview_lib/bst/egress_mc_queue.py
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 mcbuffercount
|
||||||
|
import mcqueueentries
|
||||||
|
|
||||||
|
class EgressMcQueueEntry():
|
||||||
|
def __init__(self):
|
||||||
|
self._queue = None
|
||||||
|
self._port = None
|
||||||
|
self._mcbuffercount = mcbuffercount.McBufferCount()
|
||||||
|
self._mcqueueentries = mcqueueentries.McQueueEntries()
|
||||||
|
|
||||||
|
def getQueue(self):
|
||||||
|
return self._queue
|
||||||
|
|
||||||
|
def getPort(self):
|
||||||
|
return self._port
|
||||||
|
|
||||||
|
def getMCBufferCount(self):
|
||||||
|
return self._mcbuffercount.value
|
||||||
|
|
||||||
|
def getMCQueueEntries(self):
|
||||||
|
return self._mcqueueentries.value
|
||||||
|
|
||||||
|
class EgressMcQueue():
|
||||||
|
def __init__(self):
|
||||||
|
self.__table = []
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "egress-mc-queue"
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
self.__n = 0
|
||||||
|
return self
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
if self.__n >= len(self.__table):
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
n = self.__n
|
||||||
|
self.__n += 1
|
||||||
|
return self.__table[n]
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
for x in data:
|
||||||
|
val = EgressMcQueueEntry()
|
||||||
|
val._queue = x[0]
|
||||||
|
val._port = x[1]
|
||||||
|
val._mcbuffercount.parse(x)
|
||||||
|
val._mcqueueentries.parse(x)
|
||||||
|
self.__table.append(val)
|
||||||
|
|
||||||
|
|
73
broadview_lib/bst/egress_port_service_pool.py
Normal file
73
broadview_lib/bst/egress_port_service_pool.py
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 ucsharebuffercount
|
||||||
|
import umsharebuffercount
|
||||||
|
import mcsharebuffercount
|
||||||
|
import mcsharequeueentries
|
||||||
|
|
||||||
|
class EgressPortServicePoolEntry():
|
||||||
|
def __init__(self):
|
||||||
|
self._port = None
|
||||||
|
self._servicePool = None
|
||||||
|
self._umsharebuffercount = umsharebuffercount.UmShareBufferCount()
|
||||||
|
self._mcsharebuffercount = mcsharebuffercount.McShareBufferCount()
|
||||||
|
self._mcsharequeueentries = mcsharequeueentries.McShareQueueEntries()
|
||||||
|
|
||||||
|
def getPort(self):
|
||||||
|
return self._port
|
||||||
|
|
||||||
|
def getUmShareBufferCount(self):
|
||||||
|
return self._umsharebuffercount.value
|
||||||
|
|
||||||
|
def getMCShareBufferCount(self):
|
||||||
|
return self._mcsharebuffercount.value
|
||||||
|
|
||||||
|
def getMCShareQueueEntries(self):
|
||||||
|
return self._mcsharequeueentries.value
|
||||||
|
|
||||||
|
def getServicePool(self):
|
||||||
|
return self._servicePool
|
||||||
|
|
||||||
|
class EgressPortServicePool():
|
||||||
|
def __init__(self):
|
||||||
|
self.__table = []
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
self.__n = 0
|
||||||
|
return self
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
if self.__n >= len(self.__table):
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
n = self.__n
|
||||||
|
self.__n += 1
|
||||||
|
return self.__table[n]
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "egress-port-service-pool"
|
||||||
|
|
||||||
|
def parse(self, data, port=None):
|
||||||
|
for x in data:
|
||||||
|
val = EgressPortServicePoolEntry()
|
||||||
|
if port:
|
||||||
|
val._port = port
|
||||||
|
val._servicePool = x[0]
|
||||||
|
val._umsharebuffercount.parse(x)
|
||||||
|
val._mcsharebuffercount.parse(x)
|
||||||
|
val._mcsharequeueentries.parse(x)
|
||||||
|
|
||||||
|
self.__table.append(val)
|
||||||
|
|
60
broadview_lib/bst/egress_rqe_queue.py
Normal file
60
broadview_lib/bst/egress_rqe_queue.py
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 rqebuffercount
|
||||||
|
import rqequeueentries
|
||||||
|
|
||||||
|
class EgressRQEQueueEntry():
|
||||||
|
def __init__(self):
|
||||||
|
self._queue = None
|
||||||
|
self._rqebuffercount = rqebuffercount.RQEBufferCount()
|
||||||
|
self._rqequeueentries = rqequeueentries.RQEQueueEntries()
|
||||||
|
|
||||||
|
def getQueue(self):
|
||||||
|
return self._queue
|
||||||
|
|
||||||
|
def getRQEBufferCount(self):
|
||||||
|
return self._rqebuffercount.value
|
||||||
|
|
||||||
|
def getRQEQueueEntries(self):
|
||||||
|
return self._rqequeueentries.value
|
||||||
|
|
||||||
|
class EgressRQEQueue():
|
||||||
|
def __init__(self):
|
||||||
|
self.__table = []
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "egress-rqe-queue"
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
self.__n = 0
|
||||||
|
return self
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
if self.__n >= len(self.__table):
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
n = self.__n
|
||||||
|
self.__n += 1
|
||||||
|
return self.__table[n]
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
for x in data:
|
||||||
|
val = EgressRQEQueueEntry()
|
||||||
|
val._queue = x[0]
|
||||||
|
val._rqebuffercount.parse(x)
|
||||||
|
val._rqequeueentries.parse(x)
|
||||||
|
self.__table.append(val)
|
||||||
|
|
||||||
|
|
67
broadview_lib/bst/egress_service_pool.py
Normal file
67
broadview_lib/bst/egress_service_pool.py
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 umsharebuffercount
|
||||||
|
import mcsharebuffercount
|
||||||
|
import mcsharequeueentries
|
||||||
|
|
||||||
|
class EgressServicePoolEntry():
|
||||||
|
def __init__(self):
|
||||||
|
self.__servicePool = None
|
||||||
|
self._umsharebuffercount = umsharebuffercount.UmShareBufferCount()
|
||||||
|
self._mcsharebuffercount = mcsharebuffercount.McShareBufferCount()
|
||||||
|
self._mcsharequeueentries = mcsharequeueentries.McShareQueueEntries()
|
||||||
|
|
||||||
|
def getServicePool(self):
|
||||||
|
return self._servicePool
|
||||||
|
|
||||||
|
def getUmShareBufferCount(self):
|
||||||
|
return self._umsharebuffercount.value
|
||||||
|
|
||||||
|
def getMCShareBufferCount(self):
|
||||||
|
return self._mcsharebuffercount.value
|
||||||
|
|
||||||
|
def getMCShareQueueEntries(self):
|
||||||
|
return self._mcsharequeueentries.value
|
||||||
|
|
||||||
|
class EgressServicePool():
|
||||||
|
def __init__(self):
|
||||||
|
self.__table = []
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "egress-service-pool"
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
self.__n = 0
|
||||||
|
return self
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
if self.__n >= len(self.__table):
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
n = self.__n
|
||||||
|
self.__n += 1
|
||||||
|
return self.__table[n]
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
for x in data:
|
||||||
|
val = EgressServicePoolEntry()
|
||||||
|
val._servicePool = x[0]
|
||||||
|
val._umsharebuffercount.parse(x)
|
||||||
|
val._mcsharebuffercount.parse(x)
|
||||||
|
val._mcsharequeueentries.parse(x)
|
||||||
|
self.__table.append(val)
|
||||||
|
|
||||||
|
|
||||||
|
|
60
broadview_lib/bst/egress_uc_queue.py
Normal file
60
broadview_lib/bst/egress_uc_queue.py
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 ucqueuebuffercount
|
||||||
|
|
||||||
|
class EgressUcQueueEntry():
|
||||||
|
def __init__(self):
|
||||||
|
self._queue = None
|
||||||
|
self._port = None
|
||||||
|
self._ucqueuebuffercount = ucqueuebuffercount.UcQueueBufferCount()
|
||||||
|
|
||||||
|
def getQueue(self):
|
||||||
|
return self._queue
|
||||||
|
|
||||||
|
def getPort(self):
|
||||||
|
return self._port
|
||||||
|
|
||||||
|
def getUcQueueBufferCount(self):
|
||||||
|
return self._ucqueuebuffercount.value
|
||||||
|
|
||||||
|
class EgressUcQueue():
|
||||||
|
def __init__(self):
|
||||||
|
self.__table = []
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "egress-uc-queue"
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
self.__n = 0
|
||||||
|
return self
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
if self.__n >= len(self.__table):
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
n = self.__n
|
||||||
|
self.__n += 1
|
||||||
|
return self.__table[n]
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
for x in data:
|
||||||
|
val = EgressUcQueueEntry()
|
||||||
|
val._queue = x[0]
|
||||||
|
val._port = x[1]
|
||||||
|
val._ucqueuebuffercount.parse(x)
|
||||||
|
self.__table.append(val)
|
||||||
|
|
||||||
|
|
||||||
|
|
55
broadview_lib/bst/egress_uc_queue_group.py
Normal file
55
broadview_lib/bst/egress_uc_queue_group.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 ucbuffercount
|
||||||
|
|
||||||
|
class EgressUcQueueGroupEntry():
|
||||||
|
def __init__(self):
|
||||||
|
self._queueGroup = None
|
||||||
|
self._ucbuffercount = ucbuffercount.UcBufferCount()
|
||||||
|
|
||||||
|
def getQueueGroup(self):
|
||||||
|
return self._queueGroup
|
||||||
|
|
||||||
|
def getUcBufferCount(self):
|
||||||
|
return self._ucbuffercount.value
|
||||||
|
|
||||||
|
class EgressUcQueueGroup():
|
||||||
|
def __init__(self):
|
||||||
|
self.__table = []
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "egress-uc-queue-group"
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
self.__n = 0
|
||||||
|
return self
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
if self.__n >= len(self.__table):
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
n = self.__n
|
||||||
|
self.__n += 1
|
||||||
|
return self.__table[n]
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
for x in data:
|
||||||
|
val = EgressUcQueueGroupEntry()
|
||||||
|
val._queueGroup = x[0]
|
||||||
|
val._ucbuffercount.parse(x)
|
||||||
|
self.__table.append(val)
|
||||||
|
|
||||||
|
|
||||||
|
|
64
broadview_lib/bst/ingress_port_priority_group.py
Normal file
64
broadview_lib/bst/ingress_port_priority_group.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 umsharebuffercount
|
||||||
|
import umheadroombuffercount
|
||||||
|
|
||||||
|
class IngressPortPriorityGroupEntry():
|
||||||
|
def __init__(self):
|
||||||
|
self._port = None
|
||||||
|
self._priorityGroup = None
|
||||||
|
self._umsharebuffercount = umsharebuffercount.UmShareBufferCount()
|
||||||
|
self._umheadroombuffercount = umheadroombuffercount.UmHeadroomBufferCount()
|
||||||
|
|
||||||
|
def getPort(self):
|
||||||
|
return self._port
|
||||||
|
|
||||||
|
def getPriorityGroup(self):
|
||||||
|
return self._priorityGroup
|
||||||
|
|
||||||
|
def getUmShareBufferCount(self):
|
||||||
|
return self._umsharebuffercount.value
|
||||||
|
|
||||||
|
def getUmHeadroomBufferCount(self):
|
||||||
|
return self._umheadroombuffercount.value
|
||||||
|
|
||||||
|
class IngressPortPriorityGroup():
|
||||||
|
def __init__(self):
|
||||||
|
self.__table = []
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
self.__n = 0
|
||||||
|
return self
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
if self.__n >= len(self.__table):
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
n = self.__n
|
||||||
|
self.__n += 1
|
||||||
|
return self.__table[n]
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "ingress-port-priority-group"
|
||||||
|
|
||||||
|
def parse(self, data, port=None):
|
||||||
|
for x in data:
|
||||||
|
val = IngressPortPriorityGroupEntry()
|
||||||
|
if port != None:
|
||||||
|
val._port = port
|
||||||
|
val._priorityGroup = x[0]
|
||||||
|
val._umsharebuffercount.parse(x)
|
||||||
|
val._umheadroombuffercount.parse(x)
|
||||||
|
self.__table.append(val)
|
58
broadview_lib/bst/ingress_port_service_pool.py
Normal file
58
broadview_lib/bst/ingress_port_service_pool.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 umsharebuffercount
|
||||||
|
|
||||||
|
class IngressPortServicePoolEntry():
|
||||||
|
def __init__(self):
|
||||||
|
self._port = None
|
||||||
|
self._servicePool = None
|
||||||
|
self._umsharebuffercount = umsharebuffercount.UmShareBufferCount()
|
||||||
|
|
||||||
|
def getPort(self):
|
||||||
|
return self._port
|
||||||
|
|
||||||
|
def getServicePool(self):
|
||||||
|
return self._servicePool
|
||||||
|
|
||||||
|
def getUmShareBufferCount(self):
|
||||||
|
return self._umsharebuffercount.value
|
||||||
|
|
||||||
|
class IngressPortServicePool():
|
||||||
|
def __init__(self):
|
||||||
|
self.__table = []
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
self.__n = 0
|
||||||
|
return self
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
if self.__n >= len(self.__table):
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
n = self.__n
|
||||||
|
self.__n += 1
|
||||||
|
return self.__table[n]
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "ingress-port-service-pool"
|
||||||
|
|
||||||
|
def parse(self, data, port=None):
|
||||||
|
for x in data:
|
||||||
|
val = IngressPortServicePoolEntry()
|
||||||
|
if port:
|
||||||
|
val._port = port
|
||||||
|
val._servicePool = x[0]
|
||||||
|
val._umsharebuffercount.parse(x)
|
||||||
|
self.__table.append(val)
|
52
broadview_lib/bst/ingress_service_pool.py
Normal file
52
broadview_lib/bst/ingress_service_pool.py
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 umsharebuffercount
|
||||||
|
|
||||||
|
class IngressServicePoolEntry():
|
||||||
|
def __init__(self):
|
||||||
|
self._servicePool = None
|
||||||
|
self._umsharebuffercount = umsharebuffercount.UmShareBufferCount()
|
||||||
|
|
||||||
|
def getServicePool(self):
|
||||||
|
return self._servicePool
|
||||||
|
|
||||||
|
def getUmShareBufferCount(self):
|
||||||
|
return self._umsharebuffercount.value
|
||||||
|
|
||||||
|
class IngressServicePool():
|
||||||
|
def __init__(self):
|
||||||
|
self.__table = []
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
self.__n = 0
|
||||||
|
return self
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
if self.__n >= len(self.__table):
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
n = self.__n
|
||||||
|
self.__n += 1
|
||||||
|
return self.__table[n]
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "ingress-service-pool"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
for x in data:
|
||||||
|
val = IngressServicePoolEntry()
|
||||||
|
val._servicePool = x[0]
|
||||||
|
val._umsharebuffercount.parse(x)
|
||||||
|
self.__table.append(val)
|
24
broadview_lib/bst/mcbuffercount.py
Normal file
24
broadview_lib/bst/mcbuffercount.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class McBufferCount():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "mc-buffer-count"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[2]
|
||||||
|
self.isPercentage = False
|
25
broadview_lib/bst/mcqueueentries.py
Normal file
25
broadview_lib/bst/mcqueueentries.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class McQueueEntries():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "mc-queue-entries"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[3]
|
||||||
|
self.isPercentage = False
|
||||||
|
|
31
broadview_lib/bst/mcsharebuffercount.py
Normal file
31
broadview_lib/bst/mcsharebuffercount.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class McShareBufferCount():
|
||||||
|
def __init__(self):
|
||||||
|
self.value = None
|
||||||
|
self.isPercentage = False
|
||||||
|
|
||||||
|
def getValue(self):
|
||||||
|
return self.value
|
||||||
|
|
||||||
|
def getIsPercentage(self):
|
||||||
|
return self._isPercentage
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "mc-share-buffer-count"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[2]
|
||||||
|
self.isPercent = False
|
32
broadview_lib/bst/mcsharequeueentries.py
Normal file
32
broadview_lib/bst/mcsharequeueentries.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class McShareQueueEntries():
|
||||||
|
def __init__(self):
|
||||||
|
self.value = None
|
||||||
|
self.isPercentage = False
|
||||||
|
|
||||||
|
def getValue(self):
|
||||||
|
return self.value
|
||||||
|
|
||||||
|
def getIsPercentage(self):
|
||||||
|
return self._isPercentage
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "mc-share-queue-entries"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[3]
|
||||||
|
self.isPercent = False
|
||||||
|
|
32
broadview_lib/bst/rqebuffercount.py
Normal file
32
broadview_lib/bst/rqebuffercount.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class RQEBufferCount():
|
||||||
|
def __init__(self):
|
||||||
|
self.value = None
|
||||||
|
self.isPercent = False
|
||||||
|
|
||||||
|
def getValue(self):
|
||||||
|
return self.value
|
||||||
|
|
||||||
|
def getIsPercent(self):
|
||||||
|
return self.isPercent
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "rqe-buffer-count"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[1]
|
||||||
|
self.isPercent = False
|
||||||
|
|
25
broadview_lib/bst/rqequeueentries.py
Normal file
25
broadview_lib/bst/rqequeueentries.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class RQEQueueEntries():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "rqe-queue-entries"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[2]
|
||||||
|
self.isPercent = False
|
||||||
|
|
25
broadview_lib/bst/ucbuffercount.py
Normal file
25
broadview_lib/bst/ucbuffercount.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class UcBufferCount():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "uc-buffer-count"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[1]
|
||||||
|
self.isPercentage = False
|
||||||
|
|
32
broadview_lib/bst/ucqueuebuffercount.py
Normal file
32
broadview_lib/bst/ucqueuebuffercount.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class UcQueueBufferCount():
|
||||||
|
def __init__(self):
|
||||||
|
self.value = None
|
||||||
|
self.isPercentage = False
|
||||||
|
|
||||||
|
def getValue(self):
|
||||||
|
return self.value
|
||||||
|
|
||||||
|
def getIsPercentage(self):
|
||||||
|
return self.isPercentage
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "uc-buffer-count"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[2]
|
||||||
|
self.isPercentage = False
|
||||||
|
|
24
broadview_lib/bst/ucsharebuffercount.py
Normal file
24
broadview_lib/bst/ucsharebuffercount.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class UcShareBufferCount():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "uc-share-buffer-count"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[1]
|
||||||
|
self.isPercent = False
|
26
broadview_lib/bst/umheadroombuffercount.py
Normal file
26
broadview_lib/bst/umheadroombuffercount.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class UmHeadroomBufferCount():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "um-headroom-buffer-count"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[2]
|
||||||
|
self.percent = False
|
||||||
|
|
||||||
|
|
33
broadview_lib/bst/umsharebuffercount.py
Normal file
33
broadview_lib/bst/umsharebuffercount.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class UmShareBufferCount():
|
||||||
|
def __init__(self):
|
||||||
|
self.value = None
|
||||||
|
self.isPercentage = False
|
||||||
|
|
||||||
|
def getValue(self):
|
||||||
|
return self.value
|
||||||
|
|
||||||
|
def getIsPercentage(self):
|
||||||
|
return self._isPercentage
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "um-share-buffer-count"
|
||||||
|
|
||||||
|
def parse(self, data):
|
||||||
|
self.value = data[1]
|
||||||
|
self.isPercentage = False
|
||||||
|
|
||||||
|
|
0
broadview_lib/config/__init__.py
Normal file
0
broadview_lib/config/__init__.py
Normal file
65
broadview_lib/config/agentapi.py
Normal file
65
broadview_lib/config/agentapi.py
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 json
|
||||||
|
from collections import OrderedDict
|
||||||
|
from agentconnection import AgentConnection
|
||||||
|
|
||||||
|
class AgentAPI(object):
|
||||||
|
__serial = 1
|
||||||
|
def __init__(self):
|
||||||
|
self.__httpMethod = "POST"
|
||||||
|
self.__feature = None
|
||||||
|
self.__host = None
|
||||||
|
self.__port = None
|
||||||
|
self.__payload = None
|
||||||
|
|
||||||
|
def setHost(self, host):
|
||||||
|
self.__host = host
|
||||||
|
|
||||||
|
def getHost(self):
|
||||||
|
return self.__host
|
||||||
|
|
||||||
|
def setPort(self, port):
|
||||||
|
self.__port = port
|
||||||
|
|
||||||
|
def getPort(self):
|
||||||
|
return self.__port
|
||||||
|
|
||||||
|
def setHttpMethod(self, method):
|
||||||
|
self.__httpMethod = method
|
||||||
|
|
||||||
|
def getHttpMethod(self):
|
||||||
|
return self.__httpMethod
|
||||||
|
|
||||||
|
def setFeature(self, feature):
|
||||||
|
self.__feature = feature
|
||||||
|
|
||||||
|
def getFeature(self):
|
||||||
|
return self.__feature
|
||||||
|
|
||||||
|
def _send(self, o):
|
||||||
|
self.__payload = {}
|
||||||
|
self.__payload["jsonrpc"] = "2.0"
|
||||||
|
self.__payload["asic-id"] = o["asic-id"]
|
||||||
|
self.__payload["method"] = o["method"]
|
||||||
|
self.__payload["params"] = o["params"]
|
||||||
|
self.__payload["id"] = AgentAPI.__serial
|
||||||
|
AgentAPI.__serial = AgentAPI.__serial + 1
|
||||||
|
conn = AgentConnection(self.__host, self.__port, self.__feature)
|
||||||
|
return conn.makeRequest(self)
|
||||||
|
|
||||||
|
def getjson(self):
|
||||||
|
x = json.dumps(OrderedDict(self.__payload))
|
||||||
|
return x
|
104
broadview_lib/config/agentconnection.py
Normal file
104
broadview_lib/config/agentconnection.py
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
#/*****************************************************************************
|
||||||
|
#*
|
||||||
|
#* (C) Copyright Broadcom Corporation 2015
|
||||||
|
#*
|
||||||
|
#* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
#* you may not use this file except in compliance with the License.
|
||||||
|
#*
|
||||||
|
#* You may obtain a copy of the License at
|
||||||
|
#* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#*
|
||||||
|
#* Unless required by applicable law or agreed to in writing, software
|
||||||
|
#* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
#* WITHOUT 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 requests
|
||||||
|
import sys
|
||||||
|
import urllib
|
||||||
|
from xml.etree import ElementTree
|
||||||
|
import json
|
||||||
|
|
||||||
|
class RequestFailed(Exception):
|
||||||
|
'''
|
||||||
|
class to represent a failed RESTful call
|
||||||
|
'''
|
||||||
|
def __init__(self, url, http_code, open_code, open_msg):
|
||||||
|
self._url = url
|
||||||
|
self._http_code = int(http_code)
|
||||||
|
self._open_code = int(open_code)
|
||||||
|
self._open_msg = open_msg
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return repr((self._url, self._http_code, self._open_code, self._open_msg))
|
||||||
|
|
||||||
|
class AgentConnection():
|
||||||
|
def __init__(self, host, port, feature):
|
||||||
|
self.host = host
|
||||||
|
self.port = port
|
||||||
|
self.feature = feature # e.g., "bst"
|
||||||
|
|
||||||
|
def _is_ok(self, r):
|
||||||
|
return r.status_code == 200
|
||||||
|
|
||||||
|
def _raise_fail_if(self, url, r):
|
||||||
|
if not self._is_ok(r):
|
||||||
|
try:
|
||||||
|
j = r.json()["status"]
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
t = ElementTree.fromstring(r)
|
||||||
|
j = {"response_code": r.status_code,
|
||||||
|
"error_code": 0,
|
||||||
|
"msg": "XML failure response from web server"}
|
||||||
|
|
||||||
|
except:
|
||||||
|
j = {"response_code": r.status_code,
|
||||||
|
"error_code": 0,
|
||||||
|
"msg": "Unparsable response from web server"}
|
||||||
|
|
||||||
|
raise RequestFailed(url, j["response_code"], j["error_code"], j["msg"])
|
||||||
|
|
||||||
|
def makeRequest(self, request):
|
||||||
|
|
||||||
|
headers = {"Content-Type": "application/json"}
|
||||||
|
|
||||||
|
isGet = False
|
||||||
|
if request.getHttpMethod() == "GET":
|
||||||
|
isGet = True
|
||||||
|
|
||||||
|
if False and isGet:
|
||||||
|
payload = request.getjson().encode("utf-8")
|
||||||
|
if self.feature:
|
||||||
|
url = "http://%s:%d/broadview/%s/%s%s%s" % (self.host, self.port, self.feature, request.getHttpMethod(), "?req=", payload)
|
||||||
|
else:
|
||||||
|
url = "http://%s:%d/broadview/%s%s%s" % (self.host, self.port, request.getHttpMethod(), "?req=", payload)
|
||||||
|
r = requests.get(url, headers=headers)
|
||||||
|
else:
|
||||||
|
payload = request.getjson().encode("utf-8")
|
||||||
|
if self.feature:
|
||||||
|
url = "http://%s:%d/broadview/%s/%s" % (self.host, self.port, self.feature, request.getHttpMethod())
|
||||||
|
else:
|
||||||
|
url = "http://%s:%d/broadview/%s" % (self.host, self.port, request.getHttpMethod())
|
||||||
|
if isGet:
|
||||||
|
r = requests.get(url, data=payload, headers=headers)
|
||||||
|
else:
|
||||||
|
r = requests.post(url, data=payload, headers=headers)
|
||||||
|
|
||||||
|
json_data = {}
|
||||||
|
if r.status_code == 200:
|
||||||
|
try:
|
||||||
|
# Data can come back with leading.trailing spaces, which trips
|
||||||
|
# up requests' json parser. So get as test, string, and let
|
||||||
|
# Python json do the parsing
|
||||||
|
|
||||||
|
json_data = json.loads(r.text.strip())
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
self._raise_fail_if(url, r)
|
||||||
|
return (r.status_code, json_data)
|
||||||
|
|
73
broadview_lib/config/broadviewconfig.py
Normal file
73
broadview_lib/config/broadviewconfig.py
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT 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 ConfigParser
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
class BroadViewBSTSwitches():
|
||||||
|
cfg = None
|
||||||
|
bst_switches = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
if not BroadViewBSTSwitches.bst_switches:
|
||||||
|
try:
|
||||||
|
BroadViewBSTSwitches.cfg = ConfigParser.ConfigParser()
|
||||||
|
BroadViewBSTSwitches.cfg.read("/etc/broadviewswitches.conf")
|
||||||
|
BroadViewBSTSwitches.bst_switches = json.loads(BroadViewBSTSwitches.cfg.get("topology", "bst_switches"))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
if BroadViewBSTSwitches.bst_switches:
|
||||||
|
return len(BroadViewBSTSwitches.bst_switches)
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def get(self, i):
|
||||||
|
ret = None
|
||||||
|
if i >= 0 and i < len(BroadViewBSTSwitches.bst_switches):
|
||||||
|
ret = BroadViewBSTSwitches.bst_switches[i]
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
self.__n = 0
|
||||||
|
return self
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
if BroadViewBSTSwitches.bst_switches == None:
|
||||||
|
raise StopIteration
|
||||||
|
|
||||||
|
if self.__n >= len(BroadViewBSTSwitches.bst_switches):
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
n = self.__n
|
||||||
|
self.__n += 1
|
||||||
|
return BroadViewBSTSwitches.bst_switches[n]
|
||||||
|
|
||||||
|
class TestBSTSwitches(unittest.TestCase):
|
||||||
|
|
||||||
|
def test1(self):
|
||||||
|
x = BroadViewBSTSwitches()
|
||||||
|
|
||||||
|
for y in x:
|
||||||
|
self.assertTrue("ip" in y)
|
||||||
|
self.assertTrue("port" in y)
|
||||||
|
self.assertTrue("description" in y)
|
||||||
|
self.assertTrue("asics" in y)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
|
|
||||||
|
|
1218
broadview_lib/config/bst.py
Normal file
1218
broadview_lib/config/bst.py
Normal file
File diff suppressed because it is too large
Load Diff
0
broadview_lib/tests/__init__.py
Normal file
0
broadview_lib/tests/__init__.py
Normal file
23
broadview_lib/tests/base.py
Normal file
23
broadview_lib/tests/base.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2010-2011 OpenStack Foundation
|
||||||
|
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from oslotest import base
|
||||||
|
|
||||||
|
|
||||||
|
class TestCase(base.BaseTestCase):
|
||||||
|
|
||||||
|
"""Test case base class for all unit tests."""
|
28
broadview_lib/tests/test_broadview_lib.py
Normal file
28
broadview_lib/tests/test_broadview_lib.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
"""
|
||||||
|
test_broadview_lib
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
Tests for `broadview_lib` module.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from broadview_lib.tests import base
|
||||||
|
|
||||||
|
|
||||||
|
class TestBroadview_lib(base.TestCase):
|
||||||
|
|
||||||
|
def test_something(self):
|
||||||
|
pass
|
563
broadview_lib/tools/bv-bstctl.py
Normal file
563
broadview_lib/tools/bv-bstctl.py
Normal file
@ -0,0 +1,563 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
from broadview_lib.config.bst import *
|
||||||
|
from broadview_lib.config.broadviewconfig import BroadViewBSTSwitches
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
class BSTConfigCommand():
|
||||||
|
def __init__(self):
|
||||||
|
self.__cmds = {
|
||||||
|
"cfg-feature" : self.handleCfgFeature,
|
||||||
|
"cfg-tracking" : self.handleCfgTracking,
|
||||||
|
"cfg-thresholds" : self.handleCfgThresholds,
|
||||||
|
"clr-statistics" : self.handleClrStatistics,
|
||||||
|
"clr-thresholds" : self.handleClrThresholds,
|
||||||
|
"get-feature" : self.handleGetFeature,
|
||||||
|
"get-tracking" : self.handleGetTracking,
|
||||||
|
"get-thresholds" : self.handleGetThresholds,
|
||||||
|
"get-report" : self.handleGetReport,
|
||||||
|
"help": self.handleHelp,
|
||||||
|
}
|
||||||
|
|
||||||
|
self.__help = {
|
||||||
|
"cfg-feature" : self.helpCfgFeature,
|
||||||
|
"cfg-tracking" : self.helpCfgTracking,
|
||||||
|
"cfg-thresholds" : self.helpCfgThresholds,
|
||||||
|
"clr-statistics" : self.helpClrStatistics,
|
||||||
|
"clr-thresholds" : self.helpClrThresholds,
|
||||||
|
"get-feature" : self.helpGetFeature,
|
||||||
|
"get-tracking" : self.helpGetTracking,
|
||||||
|
"get-thresholds" : self.helpGetThresholds,
|
||||||
|
"get-report" : self.helpGetReport,
|
||||||
|
}
|
||||||
|
|
||||||
|
def getASICHostPort(self, args):
|
||||||
|
usage = False
|
||||||
|
asic = "1"
|
||||||
|
port = 8080
|
||||||
|
host = None
|
||||||
|
|
||||||
|
for x in args:
|
||||||
|
if "asic-id:" in x:
|
||||||
|
v = x.split(":")
|
||||||
|
if len(v) == 2:
|
||||||
|
asic = v[1]
|
||||||
|
else:
|
||||||
|
print "invalid asic-id"
|
||||||
|
usage = True
|
||||||
|
if "host:" in x:
|
||||||
|
v = x.split(":")
|
||||||
|
if len(v) == 2:
|
||||||
|
host = v[1]
|
||||||
|
else:
|
||||||
|
print "invalid host"
|
||||||
|
usage = True
|
||||||
|
if "port:" in x:
|
||||||
|
v = x.split(":")
|
||||||
|
if len(v) == 2:
|
||||||
|
port = int(v[1])
|
||||||
|
else:
|
||||||
|
print "invalid port"
|
||||||
|
usage = True
|
||||||
|
|
||||||
|
if host == None:
|
||||||
|
# host is required
|
||||||
|
print "missing host"
|
||||||
|
usage = True
|
||||||
|
|
||||||
|
return usage, asic, host, port
|
||||||
|
|
||||||
|
def usage(self):
|
||||||
|
print "usage: %s cmd host:ipv4 [port:port] [asic-id:id] [args]" % (sys.argv[0])
|
||||||
|
print
|
||||||
|
print "Commands:"
|
||||||
|
print
|
||||||
|
for key, val in self.__help.iteritems():
|
||||||
|
print
|
||||||
|
val(key)
|
||||||
|
|
||||||
|
def handleHelp(self, args):
|
||||||
|
usage = True
|
||||||
|
|
||||||
|
if len(args):
|
||||||
|
cmd = args[0]
|
||||||
|
if cmd in self.__help:
|
||||||
|
self.__help[cmd](cmd)
|
||||||
|
usage = None
|
||||||
|
|
||||||
|
return usage, None
|
||||||
|
|
||||||
|
def handleCfgFeature(self, args):
|
||||||
|
usage = False
|
||||||
|
usage, asic, host, port = self.getASICHostPort(args)
|
||||||
|
if not usage:
|
||||||
|
x = ConfigureBSTFeature(host, port)
|
||||||
|
x.setASIC(asic)
|
||||||
|
x.setEnable("enable" in args)
|
||||||
|
x.setSendAsyncReports("send_async_reports" in args)
|
||||||
|
for arg in args:
|
||||||
|
if "collection_interval:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 2:
|
||||||
|
x.setCollectionInterval(int(v[1]))
|
||||||
|
else:
|
||||||
|
print "invalid set-collection-interval argument"
|
||||||
|
usage = True
|
||||||
|
elif "trigger_rate_limit:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 2:
|
||||||
|
x.setTriggerRateLimit(int(v[1]))
|
||||||
|
else:
|
||||||
|
print "invalid trigger_rate_limit argument"
|
||||||
|
usage = True
|
||||||
|
elif "trigger_rate_limit_interval:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 2:
|
||||||
|
x.setTriggerRateLimitInterval(int(v[1]))
|
||||||
|
else:
|
||||||
|
print "invalid trigger_rate_limit_interval argument"
|
||||||
|
usage = True
|
||||||
|
|
||||||
|
x.setStatInPercentage("stat_in_percentage" in args)
|
||||||
|
x.setStatUnitsInCells("stat_units_in_cells" in args)
|
||||||
|
x.setSendSnapshotOnTrigger("send_snapshot_on_trigger" in args)
|
||||||
|
x.setAsyncFullReports("async_full_reports" in args)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
|
||||||
|
ret = None
|
||||||
|
return usage, ret
|
||||||
|
|
||||||
|
def helpCfgFeature(self, name):
|
||||||
|
print name, "[args]"
|
||||||
|
print
|
||||||
|
print "args:"
|
||||||
|
print
|
||||||
|
print " enable"
|
||||||
|
print " send_async_reports"
|
||||||
|
print " collection_interval:val"
|
||||||
|
print " stat_in_percentage"
|
||||||
|
print " stat_units_in_cells"
|
||||||
|
print " trigger_rate_limit:val"
|
||||||
|
print " trigger_rate_limit_interval:val"
|
||||||
|
print " send_snapshot_on_trigger"
|
||||||
|
print " async_full_reports"
|
||||||
|
|
||||||
|
def handleCfgTracking(self, args):
|
||||||
|
usage = False
|
||||||
|
usage, asic, host, port = self.getASICHostPort(args)
|
||||||
|
if not usage:
|
||||||
|
x = ConfigureBSTTracking(host, port)
|
||||||
|
x.setASIC(asic)
|
||||||
|
x.setTrackPeakStats("track_peak_stats" in args)
|
||||||
|
x.setTrackIngressPortPriorityGroup("track_ingress_port_priority_group" in args)
|
||||||
|
x.setTrackIngressPortServicePool("track_ingress_port_service_pool" in args)
|
||||||
|
x.setTrackIngressServicePool("track_ingress_service_pool" in args)
|
||||||
|
x.setTrackEgressPortServicePool("track_egress_port_service_pool" in args)
|
||||||
|
x.setTrackEgressServicePool("track_egress_service_pool" in args)
|
||||||
|
x.setTrackEgressUcQueue("track_egress_uc_queue" in args)
|
||||||
|
x.setTrackEgressUcQueueGroup("track_egress_uc_queue_group" in args)
|
||||||
|
x.setTrackEgressMcQueue("track_egress_mc_queue" in args)
|
||||||
|
x.setTrackEgressCPUQueue("track_egress_cpu_queue" in args)
|
||||||
|
x.setTrackEgressRQEQueue("track_egress_rqe_queue" in args)
|
||||||
|
x.setTrackDevice("track_device" in args)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
|
||||||
|
ret = None
|
||||||
|
return usage, ret
|
||||||
|
|
||||||
|
def helpCfgTracking(self, name):
|
||||||
|
print name, "[args]"
|
||||||
|
print
|
||||||
|
print "args:"
|
||||||
|
print
|
||||||
|
print " track_peak_stats"
|
||||||
|
print " track_ingress_port_priority_group"
|
||||||
|
print " track_ingress_port_service_pool"
|
||||||
|
print " track_ingress_service_pool"
|
||||||
|
print " track_egress_port_service_pool"
|
||||||
|
print " track_egress_service_pool"
|
||||||
|
print " track_egress_uc_queue"
|
||||||
|
print " track_egress_uc_queue_group"
|
||||||
|
print " track_egress_mc_queue"
|
||||||
|
print " track_egress_cpu_queue"
|
||||||
|
print " track_egress_rqe_queue"
|
||||||
|
print " track_device"
|
||||||
|
|
||||||
|
def handleCfgThresholds(self, args):
|
||||||
|
usage = False
|
||||||
|
usage, asic, host, port = self.getASICHostPort(args)
|
||||||
|
if not usage:
|
||||||
|
for arg in args:
|
||||||
|
if "device:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 2:
|
||||||
|
x = ConfigureDeviceThreshold(host, port, int(v[1]))
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
else:
|
||||||
|
print "invalid device: bad argument count"
|
||||||
|
usage = True
|
||||||
|
elif "egress-cpu-queue:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 3:
|
||||||
|
x = ConfigureEgressCpuQueueThreshold(host, port,
|
||||||
|
int(v[1]),
|
||||||
|
int(v[2]))
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
else:
|
||||||
|
print "invalid egress-cpu-queue: bad argument count"
|
||||||
|
usage = True
|
||||||
|
elif "egress-rqe-queue:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 3:
|
||||||
|
x = ConfigureEgressRqeQueueThreshold(host, port,
|
||||||
|
int(v[1]),
|
||||||
|
int(v[2]))
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
else:
|
||||||
|
print "invalid egress-rqe-queue: bad argument count"
|
||||||
|
usage = True
|
||||||
|
elif "egress-port-service-pool:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 7:
|
||||||
|
x = ConfigureEgressPortServicePoolThreshold(host, port,
|
||||||
|
v[1],
|
||||||
|
int(v[2]),
|
||||||
|
int(v[3]),
|
||||||
|
int(v[4]),
|
||||||
|
int(v[5]),
|
||||||
|
int(v[6]))
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
else:
|
||||||
|
print "invalid egress-port-service-pool: bad argument count"
|
||||||
|
usage = True
|
||||||
|
elif "egress-service-pool:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 5:
|
||||||
|
x = ConfigureEgressServicePoolThreshold(host, port,
|
||||||
|
int(v[1]),
|
||||||
|
int(v[2]),
|
||||||
|
int(v[3]),
|
||||||
|
int(v[4]))
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
else:
|
||||||
|
print "invalid egress-service-pool: bad argument count"
|
||||||
|
usage = True
|
||||||
|
elif "egress-uc-queue:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 3:
|
||||||
|
x = ConfigureEgressUcQueueThreshold(host, port,
|
||||||
|
int(v[1]),
|
||||||
|
int(v[2]))
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
else:
|
||||||
|
print "invalid egress-uc-queue: bad argument count"
|
||||||
|
usage = True
|
||||||
|
elif "egress-uc-queue-group:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 3:
|
||||||
|
x = ConfigureEgressUcQueueGroupThreshold(host, port,
|
||||||
|
int(v[1]),
|
||||||
|
int(v[2]))
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
else:
|
||||||
|
print "invalid egress-uc-queue-group: bad argument count"
|
||||||
|
usage = True
|
||||||
|
elif "egress-mc-queue:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 4:
|
||||||
|
x = ConfigureEgressMcQueueThreshold(host, port,
|
||||||
|
int(v[1]),
|
||||||
|
int(v[2]),
|
||||||
|
int(v[3]))
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
else:
|
||||||
|
print "invalid egress-mc-queue-group: bad argument count"
|
||||||
|
usage = True
|
||||||
|
elif "ingress-port-priority-group:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 5:
|
||||||
|
x = ConfigureIngressPortPriorityGroupThreshold(host, port,
|
||||||
|
v[1],
|
||||||
|
int(v[2]),
|
||||||
|
int(v[3]),
|
||||||
|
int(v[4]))
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
else:
|
||||||
|
print "invalid ingress-port-priority-group: bad argument count"
|
||||||
|
usage = True
|
||||||
|
elif "ingress-port-service-pool:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 4:
|
||||||
|
x = ConfigureIngressPortServicePoolThreshold(host, port,
|
||||||
|
v[1],
|
||||||
|
int(v[2]),
|
||||||
|
int(v[3]))
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
else:
|
||||||
|
print "invalid ingress-port-service-pool: bad argument count"
|
||||||
|
usage = True
|
||||||
|
elif "ingress-service-pool:" in arg:
|
||||||
|
v = arg.split(":")
|
||||||
|
if len(v) == 3:
|
||||||
|
x = ConfigureIngressServicePoolThreshold(host, port,
|
||||||
|
int(v[1]),
|
||||||
|
int(v[2]))
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
else:
|
||||||
|
print "invalid ingress-service-pool: bad argument count"
|
||||||
|
usage = True
|
||||||
|
|
||||||
|
ret = None
|
||||||
|
return usage, ret
|
||||||
|
|
||||||
|
def helpCfgThresholds(self, name):
|
||||||
|
print name, "[args]"
|
||||||
|
print "Any number of the following args can be used in any combination."
|
||||||
|
print
|
||||||
|
print "Format of each argument is realm:arg1:arg2:...:argn"
|
||||||
|
print
|
||||||
|
print "args:"
|
||||||
|
print
|
||||||
|
print " device:threshold"
|
||||||
|
print " egress-cpu-queue:queue:cpu-threshold"
|
||||||
|
print " egress-rqe-queue:queue:rqe-threshold"
|
||||||
|
print " egress-port-service-pool:port:service-pool:uc-share-threshold:um-share-threshold:mc-share-threshold:mc-share-queue-entries-threshold"
|
||||||
|
print " egress-service-pool:service-pool:um-share-threshold:mc-share-threshold:mc-share-queue-entries-threshold"
|
||||||
|
print " egress-uc-queue:queue:uc-threshold"
|
||||||
|
print " egress-uc-queue-group:queue-group:uc-threshold"
|
||||||
|
print " egress-mc-queue:queue:mc-queue-entries-threshold"
|
||||||
|
print " ingress-port-priority-group:port:priority-group:um-share-threshold:um-headroom-threshold"
|
||||||
|
print " ingress-port-service-pool:port:service-pool:um-share-threshold"
|
||||||
|
print " ingress-service-pool:service-pool:um-share-threshold"
|
||||||
|
|
||||||
|
def handleClrStatistics(self, args):
|
||||||
|
usage = False
|
||||||
|
usage, asic, host, port = self.getASICHostPort(args)
|
||||||
|
if not usage:
|
||||||
|
x = ClearBSTStatistics(host, port)
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
|
||||||
|
ret = None
|
||||||
|
return usage, ret
|
||||||
|
|
||||||
|
def helpClrStatistics(self, name):
|
||||||
|
print name
|
||||||
|
|
||||||
|
def handleClrThresholds(self, args):
|
||||||
|
usage = False
|
||||||
|
usage, asic, host, port = self.getASICHostPort(args)
|
||||||
|
if not usage:
|
||||||
|
x = ClearBSTThresholds(host, port)
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status != 200:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
|
||||||
|
ret = None
|
||||||
|
return usage, ret
|
||||||
|
|
||||||
|
def helpClrThresholds(self, name):
|
||||||
|
print name
|
||||||
|
|
||||||
|
def handleGetFeature(self, args):
|
||||||
|
usage = False
|
||||||
|
ret = None
|
||||||
|
usage, asic, host, port = self.getASICHostPort(args)
|
||||||
|
if not usage:
|
||||||
|
x = GetBSTFeature(host, port)
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status == 200:
|
||||||
|
ret = x.getJSON()
|
||||||
|
print ret
|
||||||
|
else:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
|
||||||
|
return usage, ret
|
||||||
|
|
||||||
|
def helpGetFeature(self, name):
|
||||||
|
print name
|
||||||
|
|
||||||
|
def handleGetTracking(self, args):
|
||||||
|
usage = False
|
||||||
|
ret = None
|
||||||
|
usage, asic, host, port = self.getASICHostPort(args)
|
||||||
|
if not usage:
|
||||||
|
x = GetBSTTracking(host, port)
|
||||||
|
x.setASIC(asic)
|
||||||
|
status = x.send()
|
||||||
|
if status == 200:
|
||||||
|
ret = x.getJSON()
|
||||||
|
print ret
|
||||||
|
else:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
return usage, ret
|
||||||
|
|
||||||
|
def helpGetTracking(self, name):
|
||||||
|
print name
|
||||||
|
|
||||||
|
def handleGetThresholds(self, args):
|
||||||
|
usage = False
|
||||||
|
ret = None
|
||||||
|
usage, asic, host, port = self.getASICHostPort(args)
|
||||||
|
if not usage:
|
||||||
|
x = GetBSTThresholds(host, port)
|
||||||
|
x.setASIC(asic)
|
||||||
|
x.setIncludeIngressPortPriorityGroup("include_ingress_port_priority_group" in args)
|
||||||
|
x.setIncludeIngressPortServicePool("include_ingress_port_service_pool" in args)
|
||||||
|
x.setIncludeIngressServicePool("include_ingress_service_pool" in args)
|
||||||
|
x.setIncludeEgressPortServicePool("include_egress_port_service_pool" in args)
|
||||||
|
x.setIncludeEgressServicePool("include_egress_service_pool" in args)
|
||||||
|
x.setIncludeEgressUcQueue("include_egress_uc_queue" in args)
|
||||||
|
x.setIncludeEgressUcQueueGroup("include_egress_uc_queue_group" in args)
|
||||||
|
x.setIncludeEgressMcQueue("include_egress_mc_queue" in args)
|
||||||
|
x.setIncludeEgressCPUQueue("include_egress_cpu_queue" in args)
|
||||||
|
x.setIncludeEgressRQEQueue("include_egress_rqe_queue" in args)
|
||||||
|
x.setIncludeDevice("include_device" in args)
|
||||||
|
|
||||||
|
status, rep = x.send()
|
||||||
|
if status == 200:
|
||||||
|
ret = x.getJSON()
|
||||||
|
print ret
|
||||||
|
else:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
|
||||||
|
return usage, ret
|
||||||
|
|
||||||
|
def helpGetThresholds(self, name):
|
||||||
|
print name, "[args]"
|
||||||
|
print
|
||||||
|
print "args:"
|
||||||
|
print
|
||||||
|
print " include_ingress_port_priority_group"
|
||||||
|
print " include_ingress_port_service_pool"
|
||||||
|
print " include_ingress_service_pool"
|
||||||
|
print " include_egress_port_service_pool"
|
||||||
|
print " include_egress_service_pool"
|
||||||
|
print " include_egress_uc_queue"
|
||||||
|
print " include_egress_uc_queue_group"
|
||||||
|
print " include_egress_mc_queue"
|
||||||
|
print " include_egress_cpu_queue"
|
||||||
|
print " include_egress_rqe_queue"
|
||||||
|
print " include_device"
|
||||||
|
|
||||||
|
def handleGetReport(self, args):
|
||||||
|
usage = False
|
||||||
|
ret = None
|
||||||
|
usage, asic, host, port = self.getASICHostPort(args)
|
||||||
|
if not usage:
|
||||||
|
|
||||||
|
x = GetBSTReport(host, port)
|
||||||
|
x.setASIC(asic)
|
||||||
|
x.setIncludeIngressPortPriorityGroup("include_ingress_port_priority_group" in args)
|
||||||
|
x.setIncludeIngressPortServicePool("include_ingress_port_service_pool" in args)
|
||||||
|
x.setIncludeIngressServicePool("include_ingress_service_pool" in args)
|
||||||
|
x.setIncludeEgressPortServicePool("include_egress_port_service_pool" in args)
|
||||||
|
x.setIncludeEgressServicePool("include_egress_service_pool" in args)
|
||||||
|
x.setIncludeEgressUcQueue("include_egress_uc_queue" in args)
|
||||||
|
x.setIncludeEgressUcQueueGroup("include_egress_uc_queue_group" in args)
|
||||||
|
x.setIncludeEgressMcQueue("include_egress_mc_queue" in args)
|
||||||
|
x.setIncludeEgressCPUQueue("include_egress_cpu_queue" in args)
|
||||||
|
x.setIncludeEgressRQEQueue("include_egress_rqe_queue" in args)
|
||||||
|
x.setIncludeDevice("include_device" in args)
|
||||||
|
|
||||||
|
status, rep = x.send()
|
||||||
|
if status == 200:
|
||||||
|
ret = x.getJSON()
|
||||||
|
print ret
|
||||||
|
else:
|
||||||
|
print "failure: %d" % (status)
|
||||||
|
|
||||||
|
return usage, ret
|
||||||
|
|
||||||
|
def helpGetReport(self, name):
|
||||||
|
print name, "[args]"
|
||||||
|
print
|
||||||
|
print "args:"
|
||||||
|
print
|
||||||
|
print " include_ingress_port_priority_group"
|
||||||
|
print " include_ingress_port_service_pool"
|
||||||
|
print " include_ingress_service_pool"
|
||||||
|
print " include_egress_port_service_pool"
|
||||||
|
print " include_egress_service_pool"
|
||||||
|
print " include_egress_uc_queue"
|
||||||
|
print " include_egress_uc_queue_group"
|
||||||
|
print " include_egress_mc_queue"
|
||||||
|
print " include_egress_cpu_queue"
|
||||||
|
print " include_egress_rqe_queue"
|
||||||
|
print " include_device"
|
||||||
|
|
||||||
|
def isCmd(self, cmd):
|
||||||
|
return cmd in self.__cmds
|
||||||
|
|
||||||
|
def handle(self, args):
|
||||||
|
usage = True
|
||||||
|
ret = {}
|
||||||
|
status = False
|
||||||
|
if len(args):
|
||||||
|
cmd = args.pop(0)
|
||||||
|
if self.isCmd(cmd):
|
||||||
|
usage, ret = self.__cmds[cmd](args)
|
||||||
|
return usage, ret
|
||||||
|
|
||||||
|
def main(argv):
|
||||||
|
x = BSTConfigCommand()
|
||||||
|
usage, ret = x.handle(argv)
|
||||||
|
if usage:
|
||||||
|
x.usage()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main(sys.argv[1:])
|
53
broadview_lib/tools/examples.sh
Normal file
53
broadview_lib/tools/examples.sh
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# (C) Copyright Broadcom Corporation 2016
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
#
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
echo "********** cfg-feature **********"
|
||||||
|
python bv-bstctl.py cfg-feature host:10.14.244.128 enable send_async_reports
|
||||||
|
echo "********** get-feature **********"
|
||||||
|
python bv-bstctl.py get-feature host:10.14.244.128
|
||||||
|
echo "********** cfg-tracking **********"
|
||||||
|
python bv-bstctl.py cfg-tracking host:10.14.244.128 track_ingress_port_priority_group
|
||||||
|
echo "********** get-tracking **********"
|
||||||
|
python bv-bstctl.py get-tracking host:10.14.244.128
|
||||||
|
echo "********** clr-statistics **********"
|
||||||
|
python bv-bstctl.py clr-statistics host:10.14.244.128
|
||||||
|
echo "********** clr-thresholds **********"
|
||||||
|
python bv-bstctl.py clr-thresholds host:10.14.244.128
|
||||||
|
echo "********** cfg-thresholds **********"
|
||||||
|
python bv-bstctl.py get-thresholds host:10.14.244.128 include_ingress_port_priority_group include_ingress_port_service_pool include_ingress_service_pool include_egress_port_service_pool include_egress_service_pool
|
||||||
|
echo "********** get-report **********"
|
||||||
|
python bv-bstctl.py get-report host:10.14.244.128 include_ingress_port_priority_group include_ingress_port_service_pool include_ingress_service_pool include_egress_port_service_pool include_egress_service_pool
|
||||||
|
echo "********** cfg-thresholds device **********"
|
||||||
|
python bv-bstctl.py cfg-thresholds host:10.14.244.128 device:10100
|
||||||
|
echo "********** cfg-thresholds egress-cpu-queue **********"
|
||||||
|
python bv-bstctl.py cfg-thresholds host:10.14.244.128 egress-cpu-queue:5:20202
|
||||||
|
echo "********** cfg-thresholds egress-rqe-queue **********"
|
||||||
|
python bv-bstctl.py cfg-thresholds host:10.14.244.128 egress-rqe-queue:6:30130
|
||||||
|
echo "********** cfg-thresholds egress-port-service-pool **********"
|
||||||
|
python bv-bstctl.py cfg-thresholds host:10.14.244.128 egress-port-service-pool:"2":2:204556:30000:40000:5000
|
||||||
|
echo "********** cfg-thresholds egress-service-pool **********"
|
||||||
|
python bv-bstctl.py cfg-thresholds host:10.14.244.128 egress-service-pool:2:30:40:50
|
||||||
|
echo "********** cfg-thresholds egress-uc-queue **********"
|
||||||
|
python bv-bstctl.py cfg-thresholds host:10.14.244.128 egress-uc-queue:5:20200
|
||||||
|
echo "********** cfg-thresholds egress-uc-queue-group **********"
|
||||||
|
python bv-bstctl.py cfg-thresholds host:10.14.244.128 egress-uc-queue-group:5:204
|
||||||
|
echo "********** cfg-thresholds egress-mc-queue **********"
|
||||||
|
python bv-bstctl.py cfg-thresholds host:10.14.244.128 egress-mc-queue:5:204:10500
|
||||||
|
echo "********** cfg-thresholds ingress-port-priority-group **********"
|
||||||
|
python bv-bstctl.py cfg-thresholds host:10.14.244.128 ingress-port-priority-group:"5":2:20456:40404
|
||||||
|
echo "********** cfg-thresholds ingress-port-service-pool **********"
|
||||||
|
python bv-bstctl.py cfg-thresholds host:10.14.244.128 ingress-port-service-pool:"4":2:50505
|
||||||
|
echo "********** cfg-thresholds ingress-service-pool **********"
|
||||||
|
python bv-bstctl.py cfg-thresholds host:10.14.244.128 ingress-service-pool:2:56783
|
||||||
|
#
|
75
doc/source/conf.py
Normal file
75
doc/source/conf.py
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.abspath('../..'))
|
||||||
|
# -- General configuration ----------------------------------------------------
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||||
|
extensions = [
|
||||||
|
'sphinx.ext.autodoc',
|
||||||
|
#'sphinx.ext.intersphinx',
|
||||||
|
'oslosphinx'
|
||||||
|
]
|
||||||
|
|
||||||
|
# autodoc generation is a bit aggressive and a nuisance when doing heavy
|
||||||
|
# text edit cycles.
|
||||||
|
# execute "export SPHINX_DEBUG=1" in your terminal to disable
|
||||||
|
|
||||||
|
# The suffix of source filenames.
|
||||||
|
source_suffix = '.rst'
|
||||||
|
|
||||||
|
# The master toctree document.
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
# General information about the project.
|
||||||
|
project = u'broadview-lib'
|
||||||
|
copyright = u'2013, OpenStack Foundation'
|
||||||
|
|
||||||
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
|
add_function_parentheses = True
|
||||||
|
|
||||||
|
# If true, the current module name will be prepended to all description
|
||||||
|
# unit titles (such as .. function::).
|
||||||
|
add_module_names = True
|
||||||
|
|
||||||
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
|
||||||
|
# -- Options for HTML output --------------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. Major themes that come with
|
||||||
|
# Sphinx are currently 'default' and 'sphinxdoc'.
|
||||||
|
# html_theme_path = ["."]
|
||||||
|
# html_theme = '_theme'
|
||||||
|
# html_static_path = ['static']
|
||||||
|
|
||||||
|
# Output file base name for HTML help builder.
|
||||||
|
htmlhelp_basename = '%sdoc' % project
|
||||||
|
|
||||||
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
# (source start file, target name, title, author, documentclass
|
||||||
|
# [howto/manual]).
|
||||||
|
latex_documents = [
|
||||||
|
('index',
|
||||||
|
'%s.tex' % project,
|
||||||
|
u'%s Documentation' % project,
|
||||||
|
u'OpenStack Foundation', 'manual'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Example configuration for intersphinx: refer to the Python standard library.
|
||||||
|
#intersphinx_mapping = {'http://docs.python.org/': None}
|
4
doc/source/contributing.rst
Normal file
4
doc/source/contributing.rst
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
============
|
||||||
|
Contributing
|
||||||
|
============
|
||||||
|
.. include:: ../../CONTRIBUTING.rst
|
24
doc/source/index.rst
Normal file
24
doc/source/index.rst
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
.. broadview-lib documentation master file, created by
|
||||||
|
sphinx-quickstart on Tue Jul 9 22:26:36 2013.
|
||||||
|
You can adapt this file completely to your liking, but it should at least
|
||||||
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
|
Welcome to broadview-lib's documentation!
|
||||||
|
========================================================
|
||||||
|
|
||||||
|
Contents:
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
readme
|
||||||
|
installation
|
||||||
|
usage
|
||||||
|
contributing
|
||||||
|
|
||||||
|
Indices and tables
|
||||||
|
==================
|
||||||
|
|
||||||
|
* :ref:`genindex`
|
||||||
|
* :ref:`modindex`
|
||||||
|
* :ref:`search`
|
12
doc/source/installation.rst
Normal file
12
doc/source/installation.rst
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
============
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
|
||||||
|
At the command line::
|
||||||
|
|
||||||
|
$ pip install broadview-lib
|
||||||
|
|
||||||
|
Or, if you have virtualenvwrapper installed::
|
||||||
|
|
||||||
|
$ mkvirtualenv broadview-lib
|
||||||
|
$ pip install broadview-lib
|
1
doc/source/readme.rst
Normal file
1
doc/source/readme.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
.. include:: ../../README.rst
|
7
doc/source/usage.rst
Normal file
7
doc/source/usage.rst
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
========
|
||||||
|
Usage
|
||||||
|
========
|
||||||
|
|
||||||
|
To use broadview-lib in a project::
|
||||||
|
|
||||||
|
import broadview_lib
|
5
requirements.txt
Normal file
5
requirements.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# The order of packages is significant, because pip processes them in the order
|
||||||
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
|
pbr>=1.6
|
46
setup.cfg
Normal file
46
setup.cfg
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
[metadata]
|
||||||
|
name = broadview-lib
|
||||||
|
summary = OpenStack broadview-lib provides an API for interaction with Broadcom BroadView agents
|
||||||
|
description-file =
|
||||||
|
README.rst
|
||||||
|
author = OpenStack
|
||||||
|
author-email = openstack-dev@lists.openstack.org
|
||||||
|
home-page = http://www.openstack.org/
|
||||||
|
classifier =
|
||||||
|
Environment :: OpenStack
|
||||||
|
Intended Audience :: Information Technology
|
||||||
|
Intended Audience :: System Administrators
|
||||||
|
License :: OSI Approved :: Apache Software License
|
||||||
|
Operating System :: POSIX :: Linux
|
||||||
|
Programming Language :: Python
|
||||||
|
Programming Language :: Python :: 2
|
||||||
|
Programming Language :: Python :: 2.7
|
||||||
|
Programming Language :: Python :: 3
|
||||||
|
Programming Language :: Python :: 3.3
|
||||||
|
Programming Language :: Python :: 3.4
|
||||||
|
|
||||||
|
[files]
|
||||||
|
packages =
|
||||||
|
broadview_lib
|
||||||
|
|
||||||
|
[build_sphinx]
|
||||||
|
source-dir = doc/source
|
||||||
|
build-dir = doc/build
|
||||||
|
all_files = 1
|
||||||
|
|
||||||
|
[upload_sphinx]
|
||||||
|
upload-dir = doc/build/html
|
||||||
|
|
||||||
|
[compile_catalog]
|
||||||
|
directory = broadview-lib/locale
|
||||||
|
domain = broadview-lib
|
||||||
|
|
||||||
|
[update_catalog]
|
||||||
|
domain = broadview-lib
|
||||||
|
output_dir = broadview-lib/locale
|
||||||
|
input_file = broadview-lib/locale/broadview-lib.pot
|
||||||
|
|
||||||
|
[extract_messages]
|
||||||
|
keywords = _ gettext ngettext l_ lazy_gettext
|
||||||
|
mapping_file = babel.cfg
|
||||||
|
output_file = broadview-lib/locale/broadview-lib.pot
|
29
setup.py
Normal file
29
setup.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
# In python < 2.7.4, a lazy loading of package `pbr` will break
|
||||||
|
# setuptools if some other modules registered functions in `atexit`.
|
||||||
|
# solution from: http://bugs.python.org/issue15881#msg170215
|
||||||
|
try:
|
||||||
|
import multiprocessing # noqa
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['pbr'],
|
||||||
|
pbr=True)
|
14
test-requirements.txt
Normal file
14
test-requirements.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# The order of packages is significant, because pip processes them in the order
|
||||||
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
|
hacking<0.11,>=0.10.0
|
||||||
|
|
||||||
|
coverage>=3.6
|
||||||
|
python-subunit>=0.0.18
|
||||||
|
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||||
|
oslosphinx>=2.5.0 # Apache-2.0
|
||||||
|
oslotest>=1.10.0 # Apache-2.0
|
||||||
|
testrepository>=0.0.18
|
||||||
|
testscenarios>=0.4
|
||||||
|
testtools>=1.4.0
|
60
tox.ini
Normal file
60
tox.ini
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
[tox]
|
||||||
|
minversion = 1.8
|
||||||
|
envlist = py34-constraints,py27-constraints,pypy-constraints,pep8-constraints
|
||||||
|
skipsdist = True
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
usedevelop = True
|
||||||
|
install_command =
|
||||||
|
constraints: {[testenv:common-constraints]install_command}
|
||||||
|
pip install -U {opts} {packages}
|
||||||
|
setenv =
|
||||||
|
VIRTUAL_ENV={envdir}
|
||||||
|
deps = -r{toxinidir}/test-requirements.txt
|
||||||
|
commands = python setup.py test --slowest --testr-args='{posargs}'
|
||||||
|
|
||||||
|
[testenv:common-constraints]
|
||||||
|
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
||||||
|
|
||||||
|
[testenv:pep8]
|
||||||
|
commands = flake8 {posargs}
|
||||||
|
|
||||||
|
[testenv:pep8-constraints]
|
||||||
|
install_command = {[testenv:common-constraints]install_command}
|
||||||
|
commands = flake8 {posargs}
|
||||||
|
|
||||||
|
[testenv:venv]
|
||||||
|
commands = {posargs}
|
||||||
|
|
||||||
|
[testenv:venv-constraints]
|
||||||
|
install_command = {[testenv:common-constraints]install_command}
|
||||||
|
commands = {posargs}
|
||||||
|
|
||||||
|
[testenv:cover]
|
||||||
|
commands = python setup.py test --coverage --testr-args='{posargs}'
|
||||||
|
|
||||||
|
[testenv:cover-constraints]
|
||||||
|
install_command = {[testenv:common-constraints]install_command}
|
||||||
|
commands = python setup.py test --coverage --testr-args='{posargs}'
|
||||||
|
|
||||||
|
[testenv:docs]
|
||||||
|
commands = python setup.py build_sphinx
|
||||||
|
|
||||||
|
[testenv:docs-constraints]
|
||||||
|
install_command = {[testenv:common-constraints]install_command}
|
||||||
|
commands = python setup.py build_sphinx
|
||||||
|
|
||||||
|
[testenv:debug]
|
||||||
|
commands = oslo_debug_helper {posargs}
|
||||||
|
|
||||||
|
[testenv:debug-constraints]
|
||||||
|
install_command = {[testenv:common-constraints]install_command}
|
||||||
|
commands = oslo_debug_helper {posargs}
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
# E123, E125 skipped as they are invalid PEP-8.
|
||||||
|
|
||||||
|
show-source = True
|
||||||
|
ignore = E123,E125
|
||||||
|
builtins = _
|
||||||
|
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
|
Loading…
Reference in New Issue
Block a user