Age | Commit message (Collapse) | Author | Files | Lines |
|
Type: fix
Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com>
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Change-Id: Ie5c197f6ec0d41d5e405b22662701d83ad94d29e
(cherry picked from commit c9ae8cfaccd75fbc2dc27bdebccdbd14fc0cb60c)
|
|
Raise IOError so that the blocking code retries not only on
optimistic locking failures but also on data segment illegal reads.
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I6bb250e239486b60192004271c1690e790513318
|
|
A given interface counter (e.g rx) can be accessed via
/interfaces/<interface_name>/<counter_name>.
Same goes with nodes: /nodes/<node_name>/<counter_name>
As interfaces may contain '/' in their names,
these are replaced by '_' in symlinks
Also added 2 tests for the stat segment
Type: feature
Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com>
Change-Id: I27da252e7b3dc177815616ca46b5c200a456bf0f
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
In preparation for removing Python shared memory support, change the default to use sockets.
This may affect users of PAPI. E.g. if running against instances of VPP where
the API socket is in a different location or disabled.
Type: improvement
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I96308ed70b9ff314c9b487722174f5e4b14efdd2
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
make test failed on ubuntu 18.04
File "/vpp/src/vpp-api/python/vpp_papi/vpp_stats.py", line 135, in connect
socket.close(mfd)
AttributeError: module 'socket' has no attribute 'close'
Due to ubuntu 18.04 using python3.6 and
socket.close() is introduced since python3.7
Using os.close to replace socket.close as mfd is a memory fd
Type: fix
Signed-off-by: Tianyu Li <tianyu.li@arm.com>
Change-Id: I6d980fc87ae6c77bbed416879f9b2fcd0a0abe6a
|
|
The reimplementation of python stats module mishandled the case
where pattern to ls was not a list.
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I9ba189423a76f2fd4298c4c4b19a0875f705d719
|
|
This module implement Python access to the VPP statistics segment. It
accesses the data structures directly in shared memory.
VPP uses optimistic locking, so data structures may change underneath
us while we are reading. Data is copied out and it's important to
spend as little time as possible "holding the lock".
Counters are stored in VPP as a two dimensional array.
Index by thread and index (typically sw_if_index).
Simple counters count only packets, Combined counters count packets
and octets.
Counters can be accessed in either dimension.
stat['/if/rx'] - returns 2D lists
stat['/if/rx'][0] - returns counters for all interfaces for thread 0
stat['/if/rx'][0][1] - returns counter for interface 1 on thread 0
stat['/if/rx'][0][1]['packets'] - returns the packet counter
for interface 1 on thread 0
stat['/if/rx'][:, 1] - returns the counters for interface 1 on all threads
stat['/if/rx'][:, 1].packets() - returns the packet counters for
interface 1 on all threads
stat['/if/rx'][:, 1].sum_packets() - returns the sum of packet counters for
interface 1 on all threads
stat['/if/rx-miss'][:, 1].sum() - returns the sum of packet counters for
interface 1 on all threads for simple counters
Type: refactor
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I1fe7f7c7d11378d06be8276db5e1900ecdb8f515
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
This functionality is used in make test when DEBUG=gdb is used.
Type: fix
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Change-Id: I1339e6460aa624a3bcb4b03db46991590e126f92
|
|
Type: improvement
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I9e65c94a5a05047a5104e9361ea36eac77b40442
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
Sample usage:
cls.MEMIF_DEFAULT_BUFFER_SIZE = cls.vapi.vpp.get_field_options(
'memif_create', 'buffer_size')['default']
Type: improvement
Change-Id: I298f4687623003a78c93a703d32f59a937e37bc2
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
root@ae2a2e85c5d4:/vpp/src/vpp-api/python# python3
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vpp_papi
>>> vpp_papi.__version__
'1.6.2'
Type: feature
Change-Id: I73025427a58214a842245fceaa77daa7acd3e6f8
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
missed in https://gerrit.fd.io/r/c/vpp/+/30238
Type: fix
Change-Id: I342868a77d7ca87896d97847ca6525ad1abcd1b6
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
See discussion in: https://gerrit.fd.io/r/c/vpp/+/19472
Type: refactor
Change-Id: Icbf686f615f13898d12fd211f68c3498d373a5d7
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
deprecated in 3/19
Type: refactor
Change-Id: Ia8eebaa0cd89d1e95166a62645400946d8db2f75
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
Allow for papi to accept the new enumflag type.
Change-Id: I8d8dc8fdb122e9a1b1881f5b2558635c75e4a299
Type: feature
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
(cherry picked from commit 299abebe2942b4c78b85f9f3b8843f8213bf1efe)
|
|
Type: refactor
Change-Id: I541759b4b788acf08599661eb9e7abc58e9283d2
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
This change enables a client to set debug levels
globally as well as individually.
exposes loggers as
vpp_papi
vpp_papi.serializer
vpp_papi.transport
Type: improvement
Change-Id: Ib6bd1a1f552b51a22c9fe3de819a5fb970963ae5
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
refactor the code so that snippets of json can be used to test vpp_papi
example unit test provided
Type: improvement
Change-Id: Ibec608fd2e5b12515aa4db17d85d4319134c22ea
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
Type: fix
Change-Id: I8bd20fb38e132f6ab8cbc0e73095b649b5946498
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
remove the dependency on the aenum package which was used to
provide Enum.IntFlag which is now available in the python stdlib.
aenum is not provided as a .deb and causes issues in packaging.
Type: fix
Change-Id: Ie45ec2130a767345f0aad038451780a5ddc7e8db
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
The Python VPP Stats module also used the VPP heap.
Fix so it now explicitly allocates a heap.
Fixes: f68fccfe7e188fec2c9f91da38ca9acf6f67d811
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I0bd4ae64d6c89cdf634d8d9a91c23ab38017c5cc
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
Having the constructor in the vppapiclient library led to
conflicts with applications wanting to allocate their own heap.
Note: Change of behaviour, applications that do not use a CLIB
heap must now call vac_mem_init() before using any functions from
vppapiclient.
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: Ib155a54579ea5a0dbc26cb4b6daca1274e1dfdfa
|
|
Represent pointers directly in shared memory and require clients to adjust for
shared memory segment being mapped at different base address.
Deprecated: stat_segment_pointer() / stat_segment_offset()
Added: stat_segment_adjust()
Bumped the stat segment version to 2.
Type: refactor
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I33e756187b8903b45dcd353e6c1a101b7a4acb79
|
|
In unions all representations of the union are decoded.
Which means trying to decode something that isn't an address
might have invalid address family types.
Type: fix
Ticket: VPP-1884
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: Id3381ef8cc885952c1eb488ebc70e276eaceb366
|
|
Instead of having to wrap dump/detail calls in control ping, send details messages in between a normal
reply / request pair. As expressed in the below service statement.
Example:
service {
rpc map_domains_gets returns map_domains_get_reply
stream map_domain_details;
};
define map_domains_get
{
u32 client_index;
u32 context;
u32 cursor;
};
define map_domains_get_reply
{
u32 context;
i32 retval;
u32 cursor;
};
To avoid blocking the main thread for too long, the replies are now sent in client message queue size
chunks. The reply message returns VNET_API_ERROR_EAGAIN when there is more to read.
The API handler must also include a "cursor" that is used to the next call to the get function.
API handler example:
REPLY_AND_DETAILS_MACRO (VL_API_MAP_DOMAINS_GET_REPLY, mm->domains,
({
send_domain_details (cursor, rp, mp->context);
}));
The macro starts from cursor and iterates through the pool
until vl_api_process_may_suspend() returns true or the iteration
reaches the end of the list.
Client Example:
cursor = 0
d = []
while True:
rv, details = map_domains_get(cursor=cursor)
d += details
if rv.retval == 0 or rv.retval != -165:
break
cursor = rv.cursor
or the convenience iterator:
for x in vpp.details_iter(vpp.api.map_domains_get):
pass
or
list(details_iter(map_domains_get))
Change-Id: Iad9f6b41b0ef886adb584c97708dd91cf552749e
Type: feature
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
Type: fix
Change-Id: I9cdfbffd6333d090f970422bf047aaa90c1e4c65
Signed-off-by: Damjan Marion <damarion@cisco.com>
|
|
Breaks on Ubuntu 20.04 otherwise.
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I407215a03948d6e49152ee97099539bb625c12ef
|
|
Add vpp specific properties to ip addresses for use in the api.
.vapi_af -- returns [ADDRESS_IP4, ADDRESS_IP6]
.vapi_af_name -- returns the string ['ip4', 'ip6']
Update tests to demonstrate usage.
Type: feature
Change-Id: I43447a1522769d99f89debdc714c51700068d771
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
remove wait-loop on stats socket from test framework.
Type: refactor
Change-Id: I5bb95a7c597707a87f9d9a471215c4b4af1a2280
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
Type: feature
Change-Id: Ic6d44122d3e62e09402e3f1946f7e57e9b5e7c5f
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
add the ability to override the default timeout value on a per-call
basis.
Use:
rv = self.vapi.papi.cli_inband(cmd='wait 10', _timeout=15)
Type: feature
Change-Id: Ia90a58586a1f63e02118599a2a4b7141e5a0b90d
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
Reported by Vratko's review.
(Thanks for the review)
Fixes: 14b0b4791c0b8c886e7b5c9ca667d060f0bada0b
Type: fix
Change-Id: I9c080c0c40060cc77977e76edae03d60eb393ce2
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
Type: fix
Change-Id: I91063e2096fb09c34898a611184c8381fccdb333
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
File "/vpp/src/vpp-api/python/vpp_papi/vpp_serializer.py", line 512, in __init__
'Unknown message type {}'.format(f_type))
vpp_papi.vpp_serializer.VPPSerializerValueError: Unknown message type i16
Type: fix
Change-Id: Ibf73dc8df90153db586afe614e47be49739bac2f
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
Type: feature
Change-Id: Id3cd89eca0deddb70f506239f9d0543fc28cf7f4
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
Add PAPI support for VppTypeAlias decaying to BaseType.
E.g vl_api_interface_index_t sw_if_index [default=0xffffffff]
Type: feature
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I2061392157c9c11fbb0ff9e5406ea65489b017e9
|
|
Allows for comparison without needing str(MACAddress())
Traceback (most recent call last):
File "/vpp/test/test_ip6.py", line 1074, in test_icmpv6_echo
self.assertEqual(ether.dst, self.pg0.remote_mac)
AssertionError: '02:01:00:00:ff:02' != MACAddress(02:01:00:00:ff:02)
Type: feature
Change-Id: Ife1cbfc74d477695d15b33a19da7dd2fa241a348
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
|
|
If a client application is built against 19.08, it can dump the "manifest" of API signatures.
Either the all APIs (--dump) or the APIs it is interested in (--dumpfiltered).
When the developers of said client application wants to verify that it works with VPP 20.01.
It can connect to VPP and --validate the old mainfest file, and will be told a list of
messages (both request and reply) that has changed.
import argparse
from vpp_papi import VPP
import sys
import argparse
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
group.add_argument("--dump", action="store_true")
group.add_argument("--dumpfiltered", action="store_true")
group.add_argument("--validate", action="store_true")
args = parser.parse_args()
vpp = VPP(use_socket=True)
vpp.connect(name='apimanifest')
if args.validate:
# Verify manifest
message_table = eval(sys.stdin.read())
missing = vpp.validate_message_table(message_table)
print ('Changed message signatures: {}'.format(missing))
elif args.dump:
# Output manifest to stdout
print('{}'.format(vpp.dump_message_table()))
elif args.dumpfiltered:
# Output manifest to stdout
filterlist = eval(sys.stdin.read())
print('{}'.format(vpp.dump_message_table_filtered(filterlist)))
vpp.disconnect()
Type: feature
Change-Id: I7e708b36f599ed88e4864970c8593cc2fe5fbf61
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
Type: fix
Since CentOS 8, RPM build script doesn't accept '#!/usr/bin/env python'
as a valid shebang line. It requires scripts to explicitly chose
between python2 or python3.
Change all to use python3 as suggested by Paul Vinciguerra.
Depends-On: https://gerrit.fd.io/r/23170
Signed-off-by: Renato Botelho do Couto <renato@netgate.com>
Change-Id: Ie72af9f60fd0609e07f05b70f8d96e738b2754d1
|
|
The BaseTypers object were reused, so a default for anyother mesage
would be inherited in new messages.
Type: fix
Fixes: 85465588b18fef9c4712f864f512e00741e2d4f2
Change-Id: Ie1efb85a76b088653eb9ea4b88540c98b6b0aad0
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I3cf5295f1a85579a66ba38ca1f74678b45474959
|
|
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I3255702e7c562c8d04a91a095e245756c6443a9e
|
|
No point in checking the return value,
as .sendall() raises on error
(and the previous check was missing "not").
Type: fix
Change-Id: I9e07709ddd7093f91ffef87808abbab264b8aa5a
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
|
|
In the previous implementation of socket transport for PAPI,
socket methods .send and .recv_into were used.
But they are not guaranteed to send/receive all the data
for the full message. The receive part contained a loop,
but it handled only the main message, not the header.
This patch replaces .send with .sendall
and uses newly defined _read_fixed method.
Also, removed Paul from maintainers,
as he is not active much, lately.
Type: fix
Change-Id: Iae1a68bf8f9e666856b7c7d62ebfe22defc5dfe1
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
|
|
Previously, self.transport.q got the messages
(at least for socket transport), stored in the encoded (packed) form.
In order to avoid accessing internals for async reads,
a new method is introduced, to perform
blocking reads of decoded (unpacked) messages.
The method is also used in _call_vpp(),
so sync and async reads are kept compatible.
Type: feature
Change-Id: Id49792dfa57c00b1a14a198031c5398d09a9ba20
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
|
|
Dumping whole cli_inband output causes huge unformatted messages written
to logger, so truncate these to avoid that.
Type: fix
Change-Id: I59565a98e3595cbfe4971cc346e104cb198d8f24
Signed-off-by: Klement Sekera <ksekera@cisco.com>
|
|
One type for address with prefix and one type for prefix.
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: Icfec51d9b7d5cde1d69fbecdd97498688ab7b295
Signed-off-by: Ole Troan <ot@cisco.com>
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
In addition to the external vppapitrace tool, VPP itself supports dumping of API trace files.
In two formats, "custom-dump" and "dump". "dump" gives a human friendly list,
and "custom-dump" is meant to give a list of commands that can be fed to VAT.
This patch only deals with "dump".
Prior to this fix, auto-generation was only done for the basic types.
This fix adds support for any type, including lists, and supports pretty-printing
of enums, strings, IP addresses, MAC addresses and so on.
Usage: api trace dump <api-trace-file>
For example
Change-Id: I4e485680e6dcfce7489299ae6cf31d835071ac40
---------- trace 48 -----------
vl_api_sw_interface_set_flags_t:
_vl_msg_id: 75
client_index: 0
context: 10
sw_if_index: 1
flags: IF_STATUS_API_FLAG_ADMIN_UP
---------- trace 49 -----------
vl_api_sw_interface_add_del_address_t:
_vl_msg_id: 88
client_index: 0
context: 11
sw_if_index: 1
is_add: 1
del_all: 0
prefix: 172.16.1.1/24
---------- trace 51 -----------
vl_api_cli_inband_t:
_vl_msg_id: 819
client_index: 0
context: 13
cmd: packet-generator capture pg0 pcap /tmp/vpp-unittest-TestMAP-YhcmDX/pg0_out.pcap disable
---------- trace 58 -----------
vl_api_ip_neighbor_add_del_t:
_vl_msg_id: 199
client_index: 0
context: 20
is_add: 1
neighbor:
sw_if_index: 2
flags: IP_API_NEIGHBOR_FLAG_NONE
mac_address: 0202.0000.ff02
ip_address: fd01:2::2
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I5556d06008de2762e7c2d35a8b0963ae670b3db1
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Signed-off-by: Ole Troan <ot@cisco.com>
Signed-off-by: Ole Troan <ot@cisco.com>
Signed-off-by: Ole Troan <ot@cisco.com>
Signed-off-by: Ole Troan <ot@cisco.com>
Signed-off-by: Ole Troan <ot@cisco.com>
Signed-off-by: Ole Troan <ot@cisco.com>
Signed-off-by: Ole Troan <ot@cisco.com>
|
|
Callback receives "reply" messages containing context,
but previously there was no easy way
to get the automatically generated context value
of the originally sent "command" message.
With this, the caller can store the contexts,
so the callback knows which command got replied to.
Type: feature
Change-Id: I58ca812d20b03916f74096c396126710115a747c
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
|
|
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: Idad79286b7730c8e85202c4b8e675ea50f8bbc48
Signed-off-by: Ole Troan <ot@cisco.com>
|