Use uBridge for VirtualBox connections plus some cleaning. Ref #267.

This commit is contained in:
grossmj
2016-06-24 18:35:39 -06:00
parent d28fad223f
commit d79fb231d3
20 changed files with 132 additions and 88 deletions

View File

@ -370,13 +370,16 @@ class VPCSVM(BaseNode):
raise VPCSError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=self._ethernet_adapter,
port_number=port_number))
if self.ubridge and self.ubridge.is_running():
yield from self._add_ubridge_udp_connection("VPCS-{}".format(self._id), self._local_udp_tunnel[1], nio)
elif self.is_running():
raise VPCSError("Sorry, adding a link to a started VPCS instance is not supported without using uBridge.")
self._ethernet_adapter.add_nio(port_number, nio)
log.info('VPCS "{name}" [{id}]: {nio} added to port {port_number}'.format(name=self._name,
id=self.id,
nio=nio,
port_number=port_number))
if self._started and self.ubridge:
yield from self._add_ubridge_udp_connection("VPCS-{}".format(self._id), self._local_udp_tunnel[1], nio)
return nio
@ -394,14 +397,16 @@ class VPCSVM(BaseNode):
raise VPCSError("Port {port_number} doesn't exist in adapter {adapter}".format(adapter=self._ethernet_adapter,
port_number=port_number))
if self.ubridge and self.ubridge.is_running():
yield from self._ubridge_send("bridge delete {name}".format(name="VPCS-{}".format(self._id)))
elif self.is_running():
raise VPCSError("Sorry, adding a link to a started VPCS instance is not supported without using uBridge.")
nio = self._ethernet_adapter.get_nio(port_number)
if isinstance(nio, NIOUDP):
self.manager.port_manager.release_udp_port(nio.lport, self._project)
self._ethernet_adapter.remove_nio(port_number)
if self._started and self.ubridge:
yield from self._ubridge_send("bridge delete {name}".format(name="VPCS-{}".format(self._id)))
log.info('VPCS "{name}" [{id}]: {nio} removed from port {port_number}'.format(name=self._name,
id=self.id,
nio=nio,
@ -434,7 +439,7 @@ class VPCSVM(BaseNode):
nio.startPacketCapture(output_file)
if self._started and self.ubridge:
if self.ubridge and self.ubridge.is_running():
yield from self._ubridge_send('bridge start_capture {name} "{output_file}"'.format(name="VPCS-{}".format(self._id),
output_file=output_file))
@ -461,7 +466,7 @@ class VPCSVM(BaseNode):
nio.stopPacketCapture()
if self._started and self.ubridge:
if self.ubridge and self.ubridge.is_running():
yield from self._ubridge_send('bridge stop_capture {name}'.format(name="VPCS-{}".format(self._id)))
log.info("VPCS '{name}' [{id}]: stopping packet capture on port {port_number}".format(name=self.name,