diff --git a/tools/dev/mininet/bmv2.py b/tools/dev/mininet/bmv2.py index 87ed1ba6d3..ad3d248dfd 100644 --- a/tools/dev/mininet/bmv2.py +++ b/tools/dev/mininet/bmv2.py @@ -83,7 +83,8 @@ class ONOSBmv2Switch(Switch): def __init__(self, name, json=None, debugger=False, loglevel="warn", elogger=False, grpcPort=None, cpuPort=255, thriftPort=None, netcfg=True, dryrun=False, pipeconfId="", - pktdump=False, valgrind=False, injectPorts=False, **kwargs): + pktdump=False, valgrind=False, withGnmi=False, + injectPorts=True, **kwargs): Switch.__init__(self, name, **kwargs) self.grpcPort = pickUnusedPort() if not grpcPort else grpcPort self.thriftPort = pickUnusedPort() if not thriftPort else thriftPort @@ -108,6 +109,7 @@ class ONOSBmv2Switch(Switch): self.netcfgfile = '/tmp/bmv2-%d-netcfg.json' % self.deviceId self.pipeconfId = pipeconfId self.injectPorts = parseBoolean(injectPorts) + self.withGnmi = parseBoolean(withGnmi) self.longitude = kwargs['longitude'] if 'longitude' in kwargs else None self.latitude = kwargs['latitude'] if 'latitude' in kwargs else None self.onosDeviceId = "device:bmv2:%d" % self.deviceId @@ -147,10 +149,6 @@ class ONOSBmv2Switch(Switch): "port": self.grpcPort, "deviceId": self.deviceId, "deviceKeyId": "p4runtime:%s" % self.onosDeviceId - }, - "gnmi": { - "ip": srcIP, - "port": self.grpcPort } }, "piPipeconf": { @@ -159,7 +157,13 @@ class ONOSBmv2Switch(Switch): "basic": basicCfg } - if(self.injectPorts): + if self.withGnmi: + cfgData["generalprovider"]["gnmi"] = { + "ip": srcIP, + "port": self.grpcPort + } + + if self.injectPorts: portData = {} portId = 1 for intfName in self.intfNames(): diff --git a/tools/dev/p4vm/README.md b/tools/dev/p4vm/README.md index de9edb717c..11cccd3de6 100644 --- a/tools/dev/p4vm/README.md +++ b/tools/dev/p4vm/README.md @@ -88,7 +88,7 @@ To generate the OVA file, in a terminal window type the following commands: ```bash cd $ONOS_ROOT/tools/dev/p4vm -./build-ova.sh +./export-ova.sh ``` This script will: diff --git a/tools/dev/p4vm/export-ova.sh b/tools/dev/p4vm/export-ova.sh index 7b94f23d34..757f94b214 100755 --- a/tools/dev/p4vm/export-ova.sh +++ b/tools/dev/p4vm/export-ova.sh @@ -15,13 +15,11 @@ sshpass -p 'rocks' \ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \ -p ${SSH_PORT} sdn@127.0.0.1 "bash /vagrant/pre-ova-cleanup.sh" -# Wait for VM to power off -sleep 10 - -# Make sure VM is not running -vagrant halt - sleep 5 +vboxmanage controlvm ${VB_UUID} acpipowerbutton + +# Wait for VM to power off +sleep 30 # Remove vagrant shared folder vboxmanage sharedfolder remove ${VB_UUID} -name "vagrant" diff --git a/tools/dev/p4vm/install-p4-tools.sh b/tools/dev/p4vm/install-p4-tools.sh index f3df6a47be..8797707936 100755 --- a/tools/dev/p4vm/install-p4-tools.sh +++ b/tools/dev/p4vm/install-p4-tools.sh @@ -259,12 +259,15 @@ function do_p4runtime { git submodule update --init --recursive ./autogen.sh - ./configure --with-proto --with-sysrepo 'CXXFLAGS=-O0 -g' + # FIXME: re-enable --with-sysrepo when gNMI support becomes more stable + # ./configure --with-proto --with-sysrepo 'CXXFLAGS=-O0 -g' + ./configure --with-proto 'CXXFLAGS=-O0 -g' make -j${NUM_CORES} sudo make install sudo ldconfig - sudo proto/sysrepo/install_yangs.sh + # FIXME: re-enable when gNMI support becomes more stable + # sudo proto/sysrepo/install_yangs.sh } function do_bmv2 { @@ -279,7 +282,10 @@ function do_bmv2 { # Simple_switch_grpc target cd targets/simple_switch_grpc ./autogen.sh - ./configure --with-sysrepo --with-thrift 'CXXFLAGS=-O0 -g' + + # FIXME: re-enable --with-sysrepo when gNMI support becomes more stable + # ./configure --with-sysrepo --with-thrift 'CXXFLAGS=-O0 -g' + ./configure --with-thrift 'CXXFLAGS=-O0 -g' make -j${NUM_CORES} sudo make install sudo ldconfig @@ -381,8 +387,9 @@ cd ${BUILD_DIR} # In dependency order. check_and_do ${PROTOBUF_COMMIT} protobuf do_protobuf protobuf check_and_do ${GRPC_COMMIT} grpc do_grpc grpc -check_and_do ${LIBYANG_COMMIT} libyang do_libyang libyang -check_and_do ${SYSREPO_COMMIT} sysrepo do_sysrepo sysrepo +# FIXME: re-enable when gNMI support becomes more stable +# check_and_do ${LIBYANG_COMMIT} libyang do_libyang libyang +# check_and_do ${SYSREPO_COMMIT} sysrepo do_sysrepo sysrepo check_and_do ${BMV2_COMMIT} bmv2 do_pi_bmv2_deps bmv2-deps check_and_do ${PI_COMMIT} p4runtime do_p4runtime p4runtime check_and_do ${BMV2_COMMIT} bmv2 do_bmv2 bmv2 diff --git a/tools/dev/p4vm/pre-ova-cleanup.sh b/tools/dev/p4vm/pre-ova-cleanup.sh index dcfecc99ca..1f52148502 100755 --- a/tools/dev/p4vm/pre-ova-cleanup.sh +++ b/tools/dev/p4vm/pre-ova-cleanup.sh @@ -16,5 +16,3 @@ rm -rf ~/p4tools/libyang/build rm -rf ~/p4tools/sysrepo/build cat /dev/null > ~/.bash_history - -sudo poweroff