code: def start_capture(self, port_number, output_file, data_link_type="DLT_EN10MB"):
          
  
          if port_number not in self._mappings:
              raise DynamipsError("Port {} is not allocated".format(port_number))
  
          nio = self._mappings[port_number]
  
          data_link_type = data_link_type.lower()
          if data_link_type.startswith("dlt_"):
              data_link_type = data_link_type[4:]
  
          if nio.input_filter[0] is not None and nio.output_filter[0] is not None:
              raise DynamipsError("Port {} has already a filter applied".format(port_number))
  
          yield from nio.bind_filter("both", "capture")
          yield from nio.setup_filter("both", '{} "{}"'.format(data_link_type, output_file))
  
          log.info('Ethernet hub "{name}" [{id}]: starting packet capture on port {port}'.format(name=self._name,
                                                                                                 id=self._id,
                                                                                                 port=port_number))
docs: Starts a packet capture.
  
          :param port_number: allocated port number
          :param output_file: PCAP destination file for the capture
          :param data_link_type: PCAP data link type (DLT_*), default is DLT_EN10MB