P4-related cherry-picks for 1.12
Squashed. Includes the following commits from master:
8b19a07297 Fixed onos.py
74174bf177 Fix 'unable to translate flow rule' in p4-tutorial icmpdropper
4555c5f308 Minor refactoring of BMv2 mininet scripts
07b2b70f53 Refactored PI-ECMP app to use action profiles of basic.p4
6ffd3772b7 ONOS-7050 First stab at PI translation store
2d4271fc20 ONOS-7050 Refactored PI translation service and store
3874b44821 ONOS-7050 Refactored P4Runtime FRP to use distributed stores
41efe435be ONOS-7050 Refactored P4Runtime GP to use distributed stores
806f7b7418 ONOS-6810 Implement Mastership handling in general DeviceProvider
c7922a4b40 ONOS-7267 Fix pipeconf UI
Change-Id: I279b6477f48ebec768b494799feb12faadbd559c
diff --git a/tools/dev/mininet/bmv2.py b/tools/dev/mininet/bmv2.py
index f218257..7066f61 100644
--- a/tools/dev/mininet/bmv2.py
+++ b/tools/dev/mininet/bmv2.py
@@ -35,7 +35,8 @@
def config(self, **params):
r = super(Host, self).config(**params)
for off in ["rx", "tx", "sg"]:
- cmd = "/sbin/ethtool --offload %s %s off" % (self.defaultIntf(), off)
+ cmd = "/sbin/ethtool --offload %s %s off"\
+ % (self.defaultIntf(), off)
self.cmd(cmd)
# disable IPv6
self.cmd("sysctl -w net.ipv6.conf.all.disable_ipv6=1")
@@ -52,7 +53,8 @@
def __init__(self, name, json=None, debugger=False, loglevel="warn", elogger=False,
persistent=False, grpcPort=None, thriftPort=None, netcfg=True, dryrun=False,
- pipeconfId="", pktdump=False, valgrind=False, **kwargs):
+ pipeconfId="", pktdump=False, valgrind=False, netcfgDelay=0,
+ **kwargs):
Switch.__init__(self, name, **kwargs)
self.grpcPort = ONOSBmv2Switch.pickUnusedPort() if not grpcPort else grpcPort
self.thriftPort = ONOSBmv2Switch.pickUnusedPort() if not thriftPort else thriftPort
@@ -71,6 +73,7 @@
self.netcfg = parseBoolean(netcfg)
self.dryrun = parseBoolean(dryrun)
self.valgrind = parseBoolean(valgrind)
+ self.netcfgDelay = netcfgDelay
self.netcfgfile = '/tmp/bmv2-%d-netcfg.json' % self.deviceId
self.pipeconfId = pipeconfId
if persistent:
@@ -229,11 +232,13 @@
out = self.cmd(cmdStr)
if out:
print out
- if self.netcfg and self.valgrind:
- # With valgrind, it takes some time before the gRPC server is available.
- # Wait before pushing the netcfg.
- info("\n*** Waiting %d seconds before pushing the config to ONOS...\n" % VALGRIND_SLEEP)
- time.sleep(VALGRIND_SLEEP)
+ if self.netcfg:
+ if self.valgrind:
+ # With valgrind, it takes some time before the gRPC server is available.
+ # Wait before pushing the netcfg.
+ info("\n*** Waiting %d seconds before pushing the config to ONOS...\n" % VALGRIND_SLEEP)
+ time.sleep(VALGRIND_SLEEP)
+ time.sleep(self.netcfgDelay)
try: # onos.py
clist = controllers[0].nodes()
diff --git a/tools/dev/mininet/onos.py b/tools/dev/mininet/onos.py
index 9b59cc7..2e7b6f7 100755
--- a/tools/dev/mininet/onos.py
+++ b/tools/dev/mininet/onos.py
@@ -364,14 +364,11 @@
time.sleep( 1 )
info( ' ssh-port' )
waitListening( server=self, port=KarafPort, callback=self.sanityCheck )
- info( ' openflow-port' )
- waitListening( server=self, port=OpenFlowPort,
- callback=self.sanityCheck )
- info( ' client' )
+ info( ' protocol' )
while True:
result = quietRun( '%s -h %s "apps -a"' %
( self.client, self.IP() ), shell=True )
- if 'openflow' in result:
+ if 'openflow' in result or 'p4runtime' in result:
break
info( '.' )
self.sanityCheck()
@@ -380,7 +377,7 @@
while True:
result = quietRun( '%s -h %s "nodes"' %
( self.client, self.IP() ), shell=True )
- nodeStr = 'id=%s, address=%s:%s, state=READY, updated' %\
+ nodeStr = 'id=%s, address=%s:%s, state=READY' %\
( self.IP(), self.IP(), CopycatPort )
if nodeStr in result:
break