def run_dhclient(self, tmpdir, interface=None, timeout=10): """Run DHCLIENT to obtain ip address via DHCP""" if interface is None: interface = self.defaultIntf() cmd = 'dhclient' opts = '' opts += ' -1' opts += ' -d' opts += ' -pf %s/dhclient-%s.pid' % (tmpdir, self.name) opts += ' -lf %s/dhclient-%s.leases' % (tmpdir, self.name) opts += ' %s' % interface dhclient_cmd = cmd + opts return self.cmd(mininet_test_util.timeout_cmd(dhclient_cmd, timeout), verbose=True)
def verify_stack_hosts(self, verify_bridge_local_rule=True, retries=3): """Verify hosts with stack LLDP messages""" lldp_cap_files = [] for host in self.hosts_name_ordered(): lldp_cap_file = os.path.join(self.tmpdir, '%s-lldp.cap' % host) lldp_cap_files.append(lldp_cap_file) host.cmd(timeout_cmd( 'tcpdump -U -n -c 1 -i %s -w %s ether proto 0x88CC and not ether src %s &' % ( host.defaultIntf(), host.MAC(), lldp_cap_file), 60)) # should not flood LLDP from hosts self.verify_lldp_blocked(self.hosts_name_ordered()) # hosts should see no LLDP probes self.verify_empty_caps(lldp_cap_files) if verify_bridge_local_rule: # Verify 802.1x flood block triggered. for dpid in self.dpids: self.wait_nonzero_packet_count_flow( {'dl_dst': '01:80:c2:00:00:00/ff:ff:ff:ff:ff:f0'}, dpid=dpid, table_id=self._FLOOD_TABLE, ofa_match=False) self.retry_net_ping(retries=retries)