Revision 54037995 mininet/net.py

View differences:

mininet/net.py
53 53
from time import sleep
54 54

  
55 55
from mininet.logging_mod import lg
56
from mininet.node import KernelSwitch
56 57
from mininet.util import quietRun, fixLimits
57 58
from mininet.util import make_veth_pair, move_intf, retry, MOVEINTF_DELAY
58 59
from mininet.xterm import cleanUpScreens, makeXterms
......
79 80

  
80 81
    def __init__(self, topo, switch, host, controller, cparams,
81 82
                 build = True, xterms = False, cleanup = False,
82
                 in_namespace = False, switch_is_kernel = True,
83
                 in_namespace = False,
83 84
                 auto_set_macs = False, auto_static_arp = False):
84 85
        '''Create Mininet object.
85 86

  
......
92 93
        @param xterms if build now, spawn xterms?
93 94
        @param cleanup if build now, cleanup before creating?
94 95
        @param in_namespace spawn switches and hosts in their own namespace?
95
        @param switch_is_kernel is the switch kernel-based?
96 96
        @param auto_set_macs set MAC addrs to DPIDs?
97 97
        @param auto_static_arp set all-pairs static MAC addrs?
98 98
        '''
......
105 105
        self.controllers = {} # controller name to Controller objects
106 106
        self.dps = 0 # number of created kernel datapaths
107 107
        self.in_namespace = in_namespace
108
        self.switch_is_kernel = switch_is_kernel
109 108
        self.xterms = xterms
110 109
        self.cleanup = cleanup
111 110
        self.auto_set_macs = auto_set_macs
......
130 129
        #lg.info('%s ' % host.name)
131 130

  
132 131
    def _add_switch(self, dpid):
133
        '''
132
        '''Add switch.
133

  
134 134
        @param dpid DPID of switch to add
135 135
        '''
136 136
        sw = None
137
        if self.switch_is_kernel:
138
            sw = self.switch('s_' + self.topo.name(dpid), 'nl:' + str(self.dps))
137
        sw_dpid = None
138
        if self.auto_set_macs:
139
            sw_dpid = dpid
140
        if self.switch is KernelSwitch:
141
            sw = self.switch('s_' + self.topo.name(dpid), dp = self.dps,
142
                             dpid = sw_dpid)
139 143
            self.dps += 1
140 144
        else:
141 145
            sw = self.switch('s_' + self.topo.name(dpid))

Also available in: Unified diff