Class DockerController
- java.lang.Object
-
- io.patriot_framework.network_simulator.docker.control.DockerController
-
- All Implemented Interfaces:
Controller
public class DockerController extends Object implements Controller
Implementation of Controller interface for Docker
-
-
Constructor Summary
Constructors Constructor Description DockerController()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildImage(File file, String tag)
Builds image from file.void
connectDeviceToNetwork(Device device, Network network)
Connects device to network.void
connectDeviceToNetwork(Device device, List<Network> networks)
Connects device to each network in network array.void
createNetwork(Network network)
Creates network.void
deployDevice(Device device, File file)
Builds image from file and then create container from built image.void
deployDevice(Device device, String tag)
Deploys device from built image.void
deployDevice(Device device, String tag, String monitoringIP, int monitoringPort)
Deploys device to network and set monitoring attributes to container.void
deployDevice(Device device, String tag, String monitoringIP, int monitoringPort, List<String> envVars)
Deploys device to network and set monitoring attributes to container.void
deployDevice(Device device, String tag, List<String> envVars)
Deploys device from built image.void
destroyDevice(Device device)
Destroys device means first stops device container and then remove container.void
destroyNetwork(Network network)
Destroys network.void
disconnectDevice(Device device, Network network)
Disconnects device from network.void
executeCommand(Device device, String command)
Executes command in device.String
findGWIPAddress(Device device)
Returns ip address of default gw interface.Integer
findGWMask(Device device)
Returns network mask of default gw interface.String
findGWNetworkIPAddress(Device device)
Returns network ip address of default gw.String
getIdentifier()
Returns String identifier of controller, Docker/Rocket/VM, ...void
startDevice(Device device)
Starts device.void
stopDevice(Device device)
Stops device.
-
-
-
Method Detail
-
connectDeviceToNetwork
public void connectDeviceToNetwork(Device device, Network network)
Description copied from interface:Controller
Connects device to network.- Specified by:
connectDeviceToNetwork
in interfaceController
- Parameters:
device
- the devicenetwork
- the network
-
connectDeviceToNetwork
public void connectDeviceToNetwork(Device device, List<Network> networks)
Description copied from interface:Controller
Connects device to each network in network array.- Specified by:
connectDeviceToNetwork
in interfaceController
- Parameters:
device
- the devicenetworks
- the networks
-
stopDevice
public void stopDevice(Device device)
Description copied from interface:Controller
Stops device.- Specified by:
stopDevice
in interfaceController
- Parameters:
device
- the router
-
disconnectDevice
public void disconnectDevice(Device device, Network network)
Description copied from interface:Controller
Disconnects device from network.- Specified by:
disconnectDevice
in interfaceController
- Parameters:
device
- the devicenetwork
- the network
-
destroyDevice
public void destroyDevice(Device device)
Description copied from interface:Controller
Destroys device means first stops device container and then remove container.- Specified by:
destroyDevice
in interfaceController
- Parameters:
device
- the device
-
createNetwork
public void createNetwork(Network network)
Description copied from interface:Controller
Creates network.- Specified by:
createNetwork
in interfaceController
- Parameters:
network
- the network
-
destroyNetwork
public void destroyNetwork(Network network)
Description copied from interface:Controller
Destroys network.- Specified by:
destroyNetwork
in interfaceController
- Parameters:
network
- the network
-
deployDevice
public void deployDevice(Device device, String tag, List<String> envVars)
Description copied from interface:Controller
Deploys device from built image.- Specified by:
deployDevice
in interfaceController
- Parameters:
device
- the devicetag
- the tag
-
deployDevice
public void deployDevice(Device device, String tag)
Description copied from interface:Controller
Deploys device from built image.- Specified by:
deployDevice
in interfaceController
- Parameters:
device
- the devicetag
- the tag
-
deployDevice
public void deployDevice(Device device, String tag, String monitoringIP, int monitoringPort, List<String> envVars)
Description copied from interface:Controller
Deploys device to network and set monitoring attributes to container.- Specified by:
deployDevice
in interfaceController
- Parameters:
device
- the devicetag
- tag to be setmonitoringIP
- ip address for monitoringmonitoringPort
- port for monitoring
-
deployDevice
public void deployDevice(Device device, String tag, String monitoringIP, int monitoringPort)
Description copied from interface:Controller
Deploys device to network and set monitoring attributes to container.- Specified by:
deployDevice
in interfaceController
- Parameters:
device
- the devicetag
- tag to be setmonitoringIP
- ip address for monitoringmonitoringPort
- port for monitoring
-
deployDevice
public void deployDevice(Device device, File file)
Description copied from interface:Controller
Builds image from file and then create container from built image.- Specified by:
deployDevice
in interfaceController
- Parameters:
device
- the devicefile
- the file
-
buildImage
public void buildImage(File file, String tag)
Description copied from interface:Controller
Builds image from file.- Specified by:
buildImage
in interfaceController
- Parameters:
file
- the imagetag
- the tag
-
findGWNetworkIPAddress
public String findGWNetworkIPAddress(Device device)
Description copied from interface:Controller
Returns network ip address of default gw.- Specified by:
findGWNetworkIPAddress
in interfaceController
- Parameters:
device
- device to be searched- Returns:
- address of gateway
-
findGWIPAddress
public String findGWIPAddress(Device device)
Description copied from interface:Controller
Returns ip address of default gw interface.- Specified by:
findGWIPAddress
in interfaceController
- Parameters:
device
- device which address is searched- Returns:
- string representation of address
-
findGWMask
public Integer findGWMask(Device device)
Description copied from interface:Controller
Returns network mask of default gw interface.- Specified by:
findGWMask
in interfaceController
- Parameters:
device
- device which mask will be returned- Returns:
- network mask of device
-
getIdentifier
public String getIdentifier()
Description copied from interface:Controller
Returns String identifier of controller, Docker/Rocket/VM, ...- Specified by:
getIdentifier
in interfaceController
- Returns:
- identifier
-
executeCommand
public void executeCommand(Device device, String command)
Description copied from interface:Controller
Executes command in device.- Specified by:
executeCommand
in interfaceController
- Parameters:
device
- where command will be executedcommand
- which will be executed
-
startDevice
public void startDevice(Device device)
Description copied from interface:Controller
Starts device.- Specified by:
startDevice
in interfaceController
- Parameters:
device
- device to start
-
-