Skip to content

Commit

Permalink
Merge pull request #176 from p4lang/1.1.x
Browse files Browse the repository at this point in the history
1.1.x
  • Loading branch information
antoninbas authored Aug 17, 2016
2 parents 8dfe64c + 629c8fc commit d410542
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.1
1.1.2
4 changes: 4 additions & 0 deletions docs/JSON_format.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ array item has the following attributes:
3-color meters
- `size`: the number of meter instances in the array
- `is_direct`: a boolean indicating whether this is a direct meter array
- `binding`: if the meter array is direct, the name of the table it is attached
to
- `result_target`: a 2-tuple representing the field where the meter result
(color) will be stored; only taken into account if `is_direct` is `true`.

Expand All @@ -181,6 +183,8 @@ array item has the following attributes:
- `id`: a unique integer (unique with respect to other counter arrays)
- `size`: the number of counter instances in the array
- `is_direct`: a boolean indicating whether this is a direct counter array
- `binding`: if the counter array is direct, the name of the table it is
attached to

Unlike for meter arrays, there is no `type` attribute because bmv2 counters
always count both bytes and packets.
Expand Down
13 changes: 9 additions & 4 deletions tools/nanomsg_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import bmpy_utils as utils

parser = argparse.ArgumentParser(description='BM nanomsg event logger client')
parser.add_argument('--socket', help='IPC socket to which to subscribe [deprecated]',
parser.add_argument('--socket', help='IPC socket to which to subscribe',
action="store", required=False)
parser.add_argument('--json', help='JSON description of P4 program [deprecated]',
action="store", required=False)
Expand Down Expand Up @@ -446,19 +446,24 @@ def get_msg_type(msg):
json_init(client)

def main():
deprecated_args = ["socket", "json"]
deprecated_args = ["json"]
for a in deprecated_args:
if getattr(args, a) is not None:
print "Command line option --{} is deprecated".format(a),
print "Command line option '--{}' is deprecated".format(a),
print "and will be ignored"

client = utils.thrift_connect_standard(args.thrift_ip, args.thrift_port)
info = client.bm_mgmt_get_info()
socket_addr = info.elogger_socket
if socket_addr is None:
print "The event logger is not enabled on the switch,",
print "run with --nanolog <ip addr>"
print "run with '--nanolog <ip addr>'"
sys.exit(1)
if args.socket is not None:
socket_addr = args.socket
else:
print "'--socket' not provided, using", socket_addr,
print "(obtained from switch)"

recv_msgs(socket_addr, client)

Expand Down
11 changes: 8 additions & 3 deletions tools/p4dbg.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
with_runtime_CLI = False

parser = argparse.ArgumentParser(description='BM nanomsg debugger')
parser.add_argument('--socket', help='Nanomsg socket to which to subscribe [deprecated]',
parser.add_argument('--socket', help='Nanomsg socket to which to subscribe',
action="store", required=False)
parser.add_argument('--thrift-port', help='Thrift server port for table updates',
type=int, action="store", default=9090)
Expand Down Expand Up @@ -1129,10 +1129,10 @@ def check_msg_CLS(self, msg, CLS):
setattr(DebuggerAPI, "complete_" + short_name, f_complete)

def main():
deprecated_args = ["socket", "json"]
deprecated_args = ["json"]
for a in deprecated_args:
if getattr(args, a) is not None:
print "Command line option --{} is deprecated".format(a),
print "Command line option '--{}' is deprecated".format(a),
print "and will be ignored"

client = utils.thrift_connect_standard(args.thrift_ip, args.thrift_port)
Expand All @@ -1141,6 +1141,11 @@ def main():
if socket_addr is None:
print "The debugger is not enabled on the switch"
sys.exit(1)
if args.socket is not None:
socket_addr = args.socket
else:
print "'--socket' not provided, using", socket_addr,
print "(obtained from switch)"

c = DebuggerAPI(socket_addr, standard_client=client)
try:
Expand Down

0 comments on commit d410542

Please sign in to comment.