Configure VLANHost according to (optional) parameters: vlan: VLAN ID for default interface
( self, vlan=100, **params )
| 37 | |
| 38 | # pylint: disable=arguments-differ |
| 39 | def config( self, vlan=100, **params ): |
| 40 | """Configure VLANHost according to (optional) parameters: |
| 41 | vlan: VLAN ID for default interface""" |
| 42 | |
| 43 | r = super( VLANHost, self ).config( **params ) |
| 44 | |
| 45 | intf = self.defaultIntf() |
| 46 | # remove IP from default, "physical" interface |
| 47 | self.cmd( 'ifconfig %s inet 0' % intf ) |
| 48 | # create VLAN interface |
| 49 | self.cmd( 'vconfig add %s %d' % ( intf, vlan ) ) |
| 50 | # assign the host's IP to the VLAN interface |
| 51 | self.cmd( 'ifconfig %s.%d inet %s' % ( intf, vlan, params['ip'] ) ) |
| 52 | # update the intf name and host's intf map |
| 53 | newName = '%s.%d' % ( intf, vlan ) |
| 54 | # update the (Mininet) interface to refer to VLAN interface name |
| 55 | intf.name = newName |
| 56 | # add VLAN interface to host's name to intf map |
| 57 | self.nameToIntf[ newName ] = intf |
| 58 | |
| 59 | return r |
| 60 | |
| 61 | |
| 62 | hosts = { 'vlan': VLANHost } |
no test coverage detected