Revision 49654212 examples/vlanhost.py

View differences:

examples/vlanhost.py
30 30
from mininet.log import error
31 31

  
32 32
class VLANHost( Host ):
33
    "Host connected to VLAN interface"
33 34

  
34
   def config( self, vlan=100, **params ):
35
    def config( self, vlan=100, **params ):
35 36
        """Configure VLANHost according to (optional) parameters:
36 37
           vlan: VLAN ID for default interface"""
37 38

  
......
90 91
            self.addLink( h, s1 )
91 92

  
92 93

  
93
def exampleCustomTags( vlan ):
94
def exampleCustomTags():
94 95
    """Simple example that exercises VLANStarTopo"""
95 96

  
96 97
    net = Mininet( topo=VLANStarTopo() )
......
110 111
    setLogLevel( 'info' )
111 112

  
112 113
    if not quietRun( 'which vconfig' ):
113
        error( "Cannot find command 'vconfig'\nThe packge",
114
        error( "Cannot find command 'vconfig'\nThe package",
114 115
               "'vlan' is required in Ubuntu or Debian,",
115 116
               "or 'vconfig' in Fedora\n" )
116 117
        exit()
117
    try:
118
        vlan = int( sys.argv[ 1 ] )
119
    except Exception:
120
        vlan = None
121 118

  
122
    if vlan:
123
        exampleAllHosts( vlan )
119
    if len( sys.argv ) >= 2:
120
        exampleAllHosts( vlan=int( sys.argv[ 1 ] ) )
124 121
    else:
125
        exampleCustomTags( vlan )
122
        exampleCustomTags()

Also available in: Unified diff