Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 1 | import os |
Carmelo Cascone | 977ae3f | 2016-06-23 19:28:28 -0700 | [diff] [blame] | 2 | import socket |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 3 | import re |
| 4 | import json |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 5 | import threading |
Brian O'Connor | 71167f9 | 2017-06-16 14:55:00 -0700 | [diff] [blame] | 6 | import urllib2 |
Carmelo Cascone | 977ae3f | 2016-06-23 19:28:28 -0700 | [diff] [blame] | 7 | |
Carmelo Cascone | 46d360b | 2017-08-29 20:20:32 +0200 | [diff] [blame] | 8 | import time |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 9 | from contextlib import closing |
Carmelo Cascone | 46d360b | 2017-08-29 20:20:32 +0200 | [diff] [blame] | 10 | |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 11 | from mininet.log import info, warn, error |
Carmelo Cascone | 3443325 | 2017-08-25 20:27:18 +0200 | [diff] [blame] | 12 | from mininet.node import Switch, Host |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 13 | |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 14 | if 'ONOS_ROOT' not in os.environ: |
| 15 | error("ERROR: environment var $ONOS_ROOT not set") |
| 16 | exit() |
| 17 | |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 18 | SIMPLE_SWITCH_GRPC = 'simple_switch_grpc' |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 19 | ONOS_ROOT = os.environ["ONOS_ROOT"] |
Carmelo Cascone | 3443325 | 2017-08-25 20:27:18 +0200 | [diff] [blame] | 20 | PKT_BYTES_TO_DUMP = 80 |
Carmelo Cascone | 46d360b | 2017-08-29 20:20:32 +0200 | [diff] [blame] | 21 | VALGRIND_PREFIX = 'valgrind --leak-check=yes' |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 22 | SWITCH_START_TIMEOUT = 5 # seconds |
| 23 | BMV2_LOG_LINES = 5 |
| 24 | |
Carmelo Cascone | 46d360b | 2017-08-29 20:20:32 +0200 | [diff] [blame] | 25 | |
| 26 | def parseBoolean(value): |
| 27 | if value in ['1', 1, 'true', 'True']: |
| 28 | return True |
| 29 | else: |
| 30 | return False |
Carmelo Cascone | 3443325 | 2017-08-25 20:27:18 +0200 | [diff] [blame] | 31 | |
| 32 | |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 33 | def pickUnusedPort(): |
| 34 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 35 | s.bind(('localhost', 0)) |
| 36 | addr, port = s.getsockname() |
| 37 | s.close() |
| 38 | return port |
| 39 | |
| 40 | |
| 41 | def writeToFile(path, value): |
| 42 | with open(path, "w") as f: |
| 43 | f.write(str(value)) |
| 44 | |
| 45 | |
| 46 | def watchDog(sw): |
| 47 | while True: |
| 48 | if sw.stopped: |
| 49 | return |
| 50 | with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s: |
| 51 | if s.connect_ex(('127.0.0.1', sw.grpcPort)) == 0: |
| 52 | time.sleep(1) |
| 53 | else: |
| 54 | warn("\n*** WARN: BMv2 instance %s (%s) died!\n" |
| 55 | % (sw.deviceId, sw.name)) |
| 56 | sw.printBmv2Log() |
| 57 | print ("-" * 80) + "\n" |
| 58 | return |
| 59 | |
| 60 | |
Carmelo Cascone | 3443325 | 2017-08-25 20:27:18 +0200 | [diff] [blame] | 61 | class ONOSHost(Host): |
| 62 | def __init__(self, name, inNamespace=True, **params): |
| 63 | Host.__init__(self, name, inNamespace=inNamespace, **params) |
| 64 | |
| 65 | def config(self, **params): |
| 66 | r = super(Host, self).config(**params) |
| 67 | for off in ["rx", "tx", "sg"]: |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 68 | cmd = "/sbin/ethtool --offload %s %s off" \ |
Carmelo Cascone | 6ec8f8f | 2017-11-22 14:27:06 -0800 | [diff] [blame] | 69 | % (self.defaultIntf(), off) |
Carmelo Cascone | 3443325 | 2017-08-25 20:27:18 +0200 | [diff] [blame] | 70 | self.cmd(cmd) |
| 71 | # disable IPv6 |
| 72 | self.cmd("sysctl -w net.ipv6.conf.all.disable_ipv6=1") |
| 73 | self.cmd("sysctl -w net.ipv6.conf.default.disable_ipv6=1") |
| 74 | self.cmd("sysctl -w net.ipv6.conf.lo.disable_ipv6=1") |
| 75 | return r |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 76 | |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 77 | |
| 78 | class ONOSBmv2Switch(Switch): |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 79 | """BMv2 software switch with gRPC server""" |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 80 | |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 81 | deviceId = 0 |
| 82 | |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 83 | def __init__(self, name, json=None, debugger=False, loglevel="warn", |
| 84 | elogger=False, grpcPort=None, cpuPort=255, |
| 85 | thriftPort=None, netcfg=True, dryrun=False, pipeconfId="", |
| 86 | pktdump=False, valgrind=False, **kwargs): |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 87 | Switch.__init__(self, name, **kwargs) |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 88 | self.grpcPort = pickUnusedPort() if not grpcPort else grpcPort |
| 89 | self.thriftPort = pickUnusedPort() if not thriftPort else thriftPort |
Carmelo Cascone | 75e9799 | 2017-06-05 02:32:47 -0400 | [diff] [blame] | 90 | if self.dpid: |
| 91 | self.deviceId = int(self.dpid, 0 if 'x' in self.dpid else 16) |
Carmelo Cascone | 977ae3f | 2016-06-23 19:28:28 -0700 | [diff] [blame] | 92 | else: |
Carmelo Cascone | 75e9799 | 2017-06-05 02:32:47 -0400 | [diff] [blame] | 93 | self.deviceId = ONOSBmv2Switch.deviceId |
| 94 | ONOSBmv2Switch.deviceId += 1 |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 95 | self.cpuPort = cpuPort |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 96 | self.json = json |
Carmelo Cascone | 46d360b | 2017-08-29 20:20:32 +0200 | [diff] [blame] | 97 | self.debugger = parseBoolean(debugger) |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 98 | self.loglevel = loglevel |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 99 | # Important: Mininet removes all /tmp/*.log files in case of exceptions. |
| 100 | # We want to be able to see the bmv2 log if anything goes wrong, hence |
| 101 | # avoid the .log extension. |
| 102 | self.logfile = '/tmp/bmv2-%d-log' % self.deviceId |
Carmelo Cascone | 46d360b | 2017-08-29 20:20:32 +0200 | [diff] [blame] | 103 | self.elogger = parseBoolean(elogger) |
| 104 | self.pktdump = parseBoolean(pktdump) |
Carmelo Cascone | 46d360b | 2017-08-29 20:20:32 +0200 | [diff] [blame] | 105 | self.netcfg = parseBoolean(netcfg) |
| 106 | self.dryrun = parseBoolean(dryrun) |
| 107 | self.valgrind = parseBoolean(valgrind) |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 108 | self.netcfgfile = '/tmp/bmv2-%d-netcfg.json' % self.deviceId |
Yi Tseng | 7875cb7 | 2017-08-08 10:15:58 -0700 | [diff] [blame] | 109 | self.pipeconfId = pipeconfId |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 110 | self.longitude = kwargs['longitude'] if 'longitude' in kwargs else None |
| 111 | self.latitude = kwargs['latitude'] if 'latitude' in kwargs else None |
Yi Tseng | 7875cb7 | 2017-08-08 10:15:58 -0700 | [diff] [blame] | 112 | self.onosDeviceId = "device:bmv2:%d" % self.deviceId |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 113 | self.logfd = None |
| 114 | self.bmv2popen = None |
| 115 | self.stopped = False |
Yi Tseng | 7875cb7 | 2017-08-08 10:15:58 -0700 | [diff] [blame] | 116 | |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 117 | # Remove files from previous executions |
| 118 | self.cleanupTmpFiles() |
| 119 | |
| 120 | writeToFile("/tmp/bmv2-%d-grpc-port" % self.deviceId, self.grpcPort) |
| 121 | writeToFile("/tmp/bmv2-%d-thrift-port" % self.deviceId, self.thriftPort) |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 122 | |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 123 | def getSourceIp(self, dstIP): |
| 124 | """ |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 125 | Queries the Linux routing table to get the source IP that can talk with |
| 126 | dstIP, and vice versa. |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 127 | """ |
| 128 | ipRouteOut = self.cmd('ip route get %s' % dstIP) |
| 129 | r = re.search(r"src (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", ipRouteOut) |
| 130 | return r.group(1) if r else None |
| 131 | |
Yi Tseng | 7875cb7 | 2017-08-08 10:15:58 -0700 | [diff] [blame] | 132 | def getDeviceConfig(self, srcIP): |
Carmelo Cascone | 2cad9ef | 2017-08-01 21:52:07 +0200 | [diff] [blame] | 133 | portData = {} |
| 134 | portId = 1 |
| 135 | for intfName in self.intfNames(): |
| 136 | if intfName == 'lo': |
| 137 | continue |
| 138 | portData[str(portId)] = { |
| 139 | "number": portId, |
| 140 | "name": intfName, |
| 141 | "enabled": True, |
| 142 | "removed": False, |
| 143 | "type": "copper", |
| 144 | "speed": 10000 |
| 145 | } |
| 146 | portId += 1 |
| 147 | |
Yi Tseng | 7875cb7 | 2017-08-08 10:15:58 -0700 | [diff] [blame] | 148 | basicCfg = { |
| 149 | "driver": "bmv2" |
| 150 | } |
| 151 | |
| 152 | if self.longitude and self.latitude: |
| 153 | basicCfg["longitude"] = self.longitude |
| 154 | basicCfg["latitude"] = self.latitude |
| 155 | |
| 156 | cfgData = { |
Carmelo Cascone | 3443325 | 2017-08-25 20:27:18 +0200 | [diff] [blame] | 157 | "generalprovider": { |
| 158 | "p4runtime": { |
| 159 | "ip": srcIP, |
| 160 | "port": self.grpcPort, |
| 161 | "deviceId": self.deviceId, |
| 162 | "deviceKeyId": "p4runtime:%s" % self.onosDeviceId |
| 163 | } |
| 164 | }, |
| 165 | "piPipeconf": { |
| 166 | "piPipeconfId": self.pipeconfId |
| 167 | }, |
| 168 | "basic": basicCfg, |
| 169 | "ports": portData |
Yi Tseng | 7875cb7 | 2017-08-08 10:15:58 -0700 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | return cfgData |
| 173 | |
| 174 | def doOnosNetcfg(self, controllerIP): |
| 175 | """ |
| 176 | Notifies ONOS about the new device via Netcfg. |
| 177 | """ |
| 178 | srcIP = self.getSourceIp(controllerIP) |
| 179 | if not srcIP: |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 180 | warn("*** WARN: unable to get switch IP address, won't do netcfg\n") |
Yi Tseng | 7875cb7 | 2017-08-08 10:15:58 -0700 | [diff] [blame] | 181 | return |
| 182 | |
Carmelo Cascone | a11279b | 2017-06-22 04:30:08 -0400 | [diff] [blame] | 183 | cfgData = { |
| 184 | "devices": { |
Yi Tseng | 7875cb7 | 2017-08-08 10:15:58 -0700 | [diff] [blame] | 185 | self.onosDeviceId: self.getDeviceConfig(srcIP) |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 186 | } |
Carmelo Cascone | a11279b | 2017-06-22 04:30:08 -0400 | [diff] [blame] | 187 | } |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 188 | with open(self.netcfgfile, 'w') as fp: |
| 189 | json.dump(cfgData, fp, indent=4) |
Carmelo Cascone | 46d360b | 2017-08-29 20:20:32 +0200 | [diff] [blame] | 190 | |
| 191 | if not self.netcfg: |
| 192 | # Do not push config to ONOS. |
| 193 | return |
| 194 | |
Brian O'Connor | 71167f9 | 2017-06-16 14:55:00 -0700 | [diff] [blame] | 195 | # Build netcfg URL |
| 196 | url = 'http://%s:8181/onos/v1/network/configuration/' % controllerIP |
| 197 | # Instantiate password manager for HTTP auth |
| 198 | pm = urllib2.HTTPPasswordMgrWithDefaultRealm() |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 199 | pm.add_password(None, url, |
| 200 | os.environ['ONOS_WEB_USER'], |
| 201 | os.environ['ONOS_WEB_PASS']) |
| 202 | urllib2.install_opener(urllib2.build_opener( |
| 203 | urllib2.HTTPBasicAuthHandler(pm))) |
Brian O'Connor | 71167f9 | 2017-06-16 14:55:00 -0700 | [diff] [blame] | 204 | # Push config data to controller |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 205 | req = urllib2.Request(url, json.dumps(cfgData), |
| 206 | {'Content-Type': 'application/json'}) |
Carmelo Cascone | a11279b | 2017-06-22 04:30:08 -0400 | [diff] [blame] | 207 | try: |
| 208 | f = urllib2.urlopen(req) |
| 209 | print f.read() |
| 210 | f.close() |
| 211 | except urllib2.URLError as e: |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 212 | warn("*** WARN: unable to push config to ONOS (%s)\n" % e.reason) |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 213 | |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 214 | def start(self, controllers): |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 215 | bmv2Args = [SIMPLE_SWITCH_GRPC] + self.grpcTargetArgs() |
| 216 | if self.valgrind: |
| 217 | bmv2Args = VALGRIND_PREFIX.split() + bmv2Args |
| 218 | |
| 219 | cmdString = " ".join(bmv2Args) |
| 220 | |
| 221 | if self.dryrun: |
| 222 | info("\n*** DRY RUN (not executing bmv2)") |
| 223 | |
| 224 | info("\nStarting BMv2 target: %s\n" % cmdString) |
| 225 | |
| 226 | try: |
| 227 | if not self.dryrun: |
| 228 | # Start the switch |
| 229 | self.logfd = open(self.logfile, "w") |
| 230 | self.bmv2popen = self.popen(cmdString, |
| 231 | stdout=self.logfd, |
| 232 | stderr=self.logfd) |
| 233 | self.waitBmv2Start() |
| 234 | # We want to be notified if BMv2 dies... |
| 235 | threading.Thread(target=watchDog, args=[self]).start() |
| 236 | |
| 237 | self.doOnosNetcfg(self.controllerIp(controllers)) |
| 238 | except Exception as ex: |
| 239 | self.killBmv2() |
| 240 | self.printBmv2Log() |
| 241 | raise ex |
| 242 | |
| 243 | def grpcTargetArgs(self): |
| 244 | args = ['--device-id %s' % str(self.deviceId)] |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 245 | for port, intf in self.intfs.items(): |
| 246 | if not intf.IP(): |
| 247 | args.append('-i %d@%s' % (port, intf.name)) |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 248 | if self.elogger: |
| 249 | nanomsg = 'ipc:///tmp/bmv2-%d-log.ipc' % self.deviceId |
| 250 | args.append('--nanolog %s' % nanomsg) |
| 251 | if self.debugger: |
| 252 | args.append('--debugger') |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 253 | args.append('--log-console') |
Carmelo Cascone | 3443325 | 2017-08-25 20:27:18 +0200 | [diff] [blame] | 254 | if self.pktdump: |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 255 | args.append('--pcap --dump-packet-data %s' % PKT_BYTES_TO_DUMP) |
Carmelo Cascone | 9e6621f | 2017-06-27 16:06:33 -0400 | [diff] [blame] | 256 | args.append('-L%s' % self.loglevel) |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 257 | args.append('--thrift-port %s' % self.thriftPort) |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 258 | if not self.json: |
| 259 | args.append('--no-p4') |
| 260 | else: |
| 261 | args.append(self.json) |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 262 | # gRPC target-specific options |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 263 | args.append('--') |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 264 | args.append('--cpu-port %s' % self.cpuPort) |
| 265 | args.append('--grpc-server-addr 0.0.0.0:%s' % self.grpcPort) |
| 266 | return args |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 267 | |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 268 | def waitBmv2Start(self): |
| 269 | # Wait for switch to open gRPC port, before sending ONOS the netcfg. |
| 270 | # Include time-out just in case something hangs. |
| 271 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 272 | endtime = time.time() + SWITCH_START_TIMEOUT |
| 273 | while True: |
| 274 | result = sock.connect_ex(('127.0.0.1', self.grpcPort)) |
| 275 | if result == 0: |
| 276 | # The port is open. Let's go! (Close socket first) |
| 277 | sock.close() |
| 278 | break |
| 279 | # Port is not open yet. If there is time, we wait a bit. |
| 280 | if endtime > time.time(): |
| 281 | time.sleep(0.2) |
| 282 | else: |
| 283 | # Time's up. |
| 284 | raise Exception("Switch did not start before timeout") |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 285 | |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 286 | def printBmv2Log(self): |
| 287 | if os.path.isfile(self.logfile): |
| 288 | print "-" * 80 |
| 289 | print "BMv2 %d log (from %s):" % (self.deviceId, self.logfile) |
| 290 | with open(self.logfile, 'r') as f: |
| 291 | lines = f.readlines() |
| 292 | if len(lines) > BMV2_LOG_LINES: |
| 293 | print "..." |
| 294 | for line in lines[-BMV2_LOG_LINES:]: |
| 295 | print line.rstrip() |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 296 | |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 297 | @staticmethod |
| 298 | def controllerIp(controllers): |
| 299 | try: |
| 300 | # onos.py |
Carmelo Cascone | 46d360b | 2017-08-29 20:20:32 +0200 | [diff] [blame] | 301 | clist = controllers[0].nodes() |
| 302 | except AttributeError: |
| 303 | clist = controllers |
| 304 | assert len(clist) > 0 |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 305 | return clist[0].IP() |
Keesjan Karsten | 8539f08 | 2018-01-04 17:03:31 +0100 | [diff] [blame] | 306 | |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 307 | def killBmv2(self, log=False): |
| 308 | if self.bmv2popen is not None: |
| 309 | self.bmv2popen.kill() |
| 310 | if self.logfd is not None: |
| 311 | if log: |
| 312 | self.logfd.write("*** PROCESS TERMINATED BY MININET ***\n") |
| 313 | self.logfd.close() |
Keesjan Karsten | 8539f08 | 2018-01-04 17:03:31 +0100 | [diff] [blame] | 314 | |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 315 | def cleanupTmpFiles(self): |
| 316 | self.cmd("rm -f /tmp/bmv2-%d-*" % self.deviceId) |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 317 | |
| 318 | def stop(self, deleteIntfs=True): |
| 319 | """Terminate switch.""" |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 320 | self.stopped = True |
| 321 | self.killBmv2(log=True) |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 322 | Switch.stop(self, deleteIntfs) |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 323 | |
| 324 | |
Carmelo Cascone | b752427 | 2017-06-05 16:53:13 -0400 | [diff] [blame] | 325 | # Exports for bin/mn |
Carmelo Cascone | 785fada | 2016-06-16 18:34:16 -0700 | [diff] [blame] | 326 | switches = {'onosbmv2': ONOSBmv2Switch} |
Carmelo Cascone | 3443325 | 2017-08-25 20:27:18 +0200 | [diff] [blame] | 327 | hosts = {'onoshost': ONOSHost} |