P4 Developer Day May 2019 (#252)

* Update user-bootstrap to use latest version (#251)

* p4c tests are failing in latest version. So, let's skip it during vagrant provisioning

* Update tutorial to use latest version of P4 tools

Modify switch.py to handle setting default_action
Use --p4runtime-files instead of deprecated --p4runtime-file and
--p4runtime-format flags
Provide standard_metadata for mark_to_drop

* Fix path for ECN exercise
This commit is contained in:
Nate Foster
2019-04-25 21:21:47 -04:00
committed by GitHub
parent 201fcf59a8
commit 01fc378076
50 changed files with 59 additions and 57 deletions

View File

@@ -17,7 +17,8 @@ from abc import abstractmethod
from datetime import datetime
import grpc
from p4 import p4runtime_pb2
from p4.v1 import p4runtime_pb2
from p4.v1 import p4runtime_pb2_grpc
from p4.tmp import p4config_pb2
MSG_LOG_MAX_LEN = 1024
@@ -41,7 +42,7 @@ class SwitchConnection(object):
if proto_dump_file is not None:
interceptor = GrpcRequestLogger(proto_dump_file)
self.channel = grpc.intercept_channel(self.channel, interceptor)
self.client_stub = p4runtime_pb2.P4RuntimeStub(self.channel)
self.client_stub = p4runtime_pb2_grpc.P4RuntimeStub(self.channel)
self.requests_stream = IterableQueue()
self.stream_msg_resp = self.client_stub.StreamChannel(iter(self.requests_stream))
self.proto_dump_file = proto_dump_file
@@ -89,7 +90,10 @@ class SwitchConnection(object):
request.device_id = self.device_id
request.election_id.low = 1
update = request.updates.add()
update.type = p4runtime_pb2.Update.INSERT
if table_entry.is_default_action:
update.type = p4runtime_pb2.Update.MODIFY
else:
update.type = p4runtime_pb2.Update.INSERT
update.entity.table_entry.CopyFrom(table_entry)
if dry_run:
print "P4Runtime Write:", request