Skip to content

Commit acab534

Browse files
committed
Add option to set OVS vendor
1 parent de8d741 commit acab534

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

bin/mn

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ class MininetRunner( object ):
234234
opts.add_option( '--prefixlen', type='int', default=8,
235235
help='[prefix length (e.g. /8) for automatic '
236236
'network configuration]' )
237+
opts.add_option( '--defVendor', action='store_true',
238+
default=False, help="Use default vendor (Nicira)")
237239

238240
self.options, self.args = opts.parse_args()
239241

@@ -289,13 +291,15 @@ class MininetRunner( object ):
289291
xterms = self.options.xterms
290292
mac = self.options.mac
291293
arp = self.options.arp
294+
defVendor = self.options.defVendor
292295
listenPort = None
293296
if not self.options.nolistenport:
294297
listenPort = self.options.listenport
295298
mn = Mininet( topo, switch, host, controller, controllerParams,
296299
inNamespace=inNamespace,
297300
xterms=xterms, autoSetMacs=mac,
298-
autoStaticArp=arp, listenPort=listenPort )
301+
autoStaticArp=arp, listenPort=listenPort,
302+
defVendor=defVendor )
299303

300304
if self.options.pre:
301305
CLI( mn, script=self.options.pre )

mininet/net.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ def __init__( self, topo=None, switch=OVSKernelSwitch, host=Host,
108108
cparams=ControllerParams( '10.0.0.0', 8 ),
109109
build=True, xterms=False, cleanup=False,
110110
inNamespace=False,
111-
autoSetMacs=False, autoStaticArp=False, listenPort=None ):
111+
autoSetMacs=False, autoStaticArp=False, listenPort=None,
112+
defVendor=False ):
112113
"""Create Mininet object.
113114
topo: Topo (topology) object or None
114115
switch: Switch class
@@ -134,6 +135,7 @@ def __init__( self, topo=None, switch=OVSKernelSwitch, host=Host,
134135
self.autoSetMacs = autoSetMacs
135136
self.autoStaticArp = autoStaticArp
136137
self.listenPort = listenPort
138+
self.defVendor = defVendor
137139

138140
self.hosts = []
139141
self.switches = []
@@ -179,11 +181,13 @@ def addSwitch( self, name, mac=None, ip=None, prefix='s', switchClass=None ):
179181
if swCl == UserSwitch:
180182
sw = swCl( name, listenPort=self.listenPort,
181183
defaultMAC=mac, defaultIP=ip,
182-
inNamespace=self.inNamespace, prefix=prefix )
184+
inNamespace=self.inNamespace, prefix=prefix,
185+
defVendor=self.defVendor )
183186
else:
184187
sw = swCl( name, listenPort=self.listenPort,
185188
defaultMAC=mac, defaultIP=ip, dp=self.dps,
186-
inNamespace=self.inNamespace , prefix=prefix )
189+
inNamespace=self.inNamespace , prefix=prefix,
190+
defVendor=self.defVendor )
187191
if not self.inNamespace and self.listenPort:
188192
self.listenPort += 1
189193
self.dps += 1

mininet/node.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ class Switch( Node ):
548548

549549
portBase = SWITCH_PORT_BASE # 0 for OF < 1.0, 1 for OF >= 1.0
550550

551-
def __init__( self, name, prefix = 's', opts='', listenPort=None, dpid=None, **kwargs):
551+
def __init__( self, name, prefix = 's', opts='', listenPort=None, dpid=None, defVendor=False, **kwargs):
552552
Node.__init__( self, name, prefix=prefix, **kwargs )
553553
self.opts = opts
554554
self.listenPort = listenPort
@@ -560,6 +560,7 @@ def __init__( self, name, prefix = 's', opts='', listenPort=None, dpid=None, **k
560560
self.dpid = "00:00:" + self.defaultMAC
561561
else:
562562
self.dpid = None
563+
self.defVendor = defVendor
563564

564565
def defaultIntf( self ):
565566
"Return interface for HIGHEST port"
@@ -775,8 +776,6 @@ def __init__( self, name, dp=None, **kwargs ):
775776
self.dp = 'mn-dp%i' % dp
776777
self.intf = self.dp
777778
OVSKernelSwitchNew.numSwitch += 1
778-
# Mark the switch so controller will send LLDP/BDDP on all ports
779-
self.opts += ' --mfr-desc="big switch networks" --dp-desc="bigtest datapath" '
780779
if self.inNamespace:
781780
error( "OVSKernelSwitch currently only works"
782781
" in the root namespace.\n" )
@@ -921,8 +920,6 @@ def __init__( self, name, dp=None, **kwargs ):
921920
Switch.__init__( self, name, **kwargs )
922921
self.dp = 'dp%i' % dp
923922
self.intf = self.dp
924-
# Mark the switch so controller will send LLDP/BDDP on all ports
925-
self.opts += ' --mfr-desc="big switch networks" --dp-desc="bigtest datapath" '
926923
if self.inNamespace:
927924
error( "OVSKernelSwitch currently only works"
928925
" in the root namespace.\n" )
@@ -956,6 +953,9 @@ def start( self, controllers ):
956953
intfs = [ self.intfs[ port ] for port in ports ]
957954
self.cmd( 'ovs-dpctl', 'add-if', self.dp, ' '.join( intfs ) )
958955
# Run protocol daemon
956+
if not self.defVendor:
957+
# Mark the switch so controller will send LLDP/BDDP on all ports
958+
self.opts += ' --mfr-desc="big switch networks" --dp-desc="bigtest datapath" '
959959
self.cmd( 'ovs-openflowd ' + self.dp +
960960
' '.join( [ ' tcp:%s:%d' % ( c.IP(), c.port ) \
961961
for c in controllers ] ) +

0 commit comments

Comments
 (0)