Fix remote packet capture for Dynamips.

This commit is contained in:
grossmj committed 2019-04-01 20:58:18 +07:00
1 parent 4cc5dbc228
commit a17119187b
16 files changed
+76 -49

No files matched your search

@@ -452,9 +452,7 @@ class ATMSwitch(Device):
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))
await nio.bind_filter("both", "capture")
await nio.setup_filter("both", '{} "{}"'.format(data_link_type, output_file))
await nio.start_packet_capture(output_file, data_link_type)
log.info('ATM switch "{name}" [{id}]: starting packet capture on port {port}'.format(name=self._name,
id=self._id,
port=port_number))
@@ -469,7 +467,7 @@ class ATMSwitch(Device):
nio = self.get_nio(port_number)
if not nio.capturing:
return
await nio.unbind_filter("both")
await nio.stop_packet_capture()
log.info('ATM switch "{name}" [{id}]: stopping packet capture on port {port}'.format(name=self._name,
id=self._id,
port=port_number))
@@ -212,9 +212,7 @@ class EthernetHub(Bridge):
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))
await nio.bind_filter("both", "capture")
await nio.setup_filter("both", '{} "{}"'.format(data_link_type, output_file))
await nio.start_packet_capture(output_file, data_link_type)
log.info('Ethernet hub "{name}" [{id}]: starting packet capture on port {port}'.format(name=self._name,
id=self._id,
port=port_number))
@@ -229,7 +227,7 @@ class EthernetHub(Bridge):
nio = self.get_nio(port_number)
if not nio.capturing:
return
await nio.unbind_filter("both")
await nio.stop_packet_capture()
log.info('Ethernet hub "{name}" [{id}]: stopping packet capture on port {port}'.format(name=self._name,
id=self._id,
port=port_number))
@@ -441,9 +441,7 @@ class EthernetSwitch(Device):
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))
await nio.bind_filter("both", "capture")
await nio.setup_filter("both", '{} "{}"'.format(data_link_type, output_file))
await nio.start_packet_capture(output_file, data_link_type)
log.info('Ethernet switch "{name}" [{id}]: starting packet capture on port {port}'.format(name=self._name,
id=self._id,
port=port_number))
@@ -458,7 +456,7 @@ class EthernetSwitch(Device):
nio = self.get_nio(port_number)
if not nio.capturing:
return
await nio.unbind_filter("both")
await nio.stop_packet_capture()
log.info('Ethernet switch "{name}" [{id}]: stopping packet capture on port {port}'.format(name=self._name,
id=self._id,
port=port_number))
@@ -338,9 +338,7 @@ class FrameRelaySwitch(Device):
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))
await nio.bind_filter("both", "capture")
await nio.setup_filter("both", '{} "{}"'.format(data_link_type, output_file))
await nio.start_packet_capture(output_file, data_link_type)
log.info('Frame relay switch "{name}" [{id}]: starting packet capture on port {port}'.format(name=self._name,
id=self._id,
port=port_number))
@@ -355,7 +353,7 @@ class FrameRelaySwitch(Device):
nio = self.get_nio(port_number)
if not nio.capturing:
return
await nio.unbind_filter("both")
await nio.stop_packet_capture()
log.info('Frame relay switch "{name}" [{id}]: stopping packet capture on port {port}'.format(name=self._name,
id=self._id,
port=port_number))
+2 -5
View File
@@ -1445,10 +1445,7 @@ class Router(BaseNode):
if nio.input_filter[0] is not None and nio.output_filter[0] is not None:
raise DynamipsError("Port {port_number} has already a filter applied on {adapter}".format(adapter=adapter,
port_number=port_number))
await nio.bind_filter("both", "capture")
await nio.setup_filter("both", '{} "{}"'.format(data_link_type, output_file))
await nio.start_packet_capture(output_file, data_link_type)
log.info('Router "{name}" [{id}]: starting packet capture on port {slot_number}/{port_number}'.format(name=self._name,
id=self._id,
nio_name=nio.name,
@@ -1480,7 +1477,7 @@ class Router(BaseNode):
if not nio.capturing:
return
await nio.unbind_filter("both")
await nio.stop_packet_capture()
log.info('Router "{name}" [{id}]: stopping packet capture on port {slot_number}/{port_number}'.format(name=self._name,
id=self._id,