Class DockerController

  • All Implemented Interfaces:
    Controller

    public class DockerController
    extends Object
    implements Controller
    Implementation of Controller interface for Docker
    • Constructor Detail

      • DockerController

        public DockerController()
        Constructor
    • Method Detail

      • connectDeviceToNetwork

        public void connectDeviceToNetwork​(Device device,
                                           Network network)
        Description copied from interface: Controller
        Connects device to network.
        Specified by:
        connectDeviceToNetwork in interface Controller
        Parameters:
        device - the device
        network - 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 interface Controller
        Parameters:
        device - the device
        networks - the networks
      • stopDevice

        public void stopDevice​(Device device)
        Description copied from interface: Controller
        Stops device.
        Specified by:
        stopDevice in interface Controller
        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 interface Controller
        Parameters:
        device - the device
        network - 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 interface Controller
        Parameters:
        device - the device
      • createNetwork

        public void createNetwork​(Network network)
        Description copied from interface: Controller
        Creates network.
        Specified by:
        createNetwork in interface Controller
        Parameters:
        network - the network
      • destroyNetwork

        public void destroyNetwork​(Network network)
        Description copied from interface: Controller
        Destroys network.
        Specified by:
        destroyNetwork in interface Controller
        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 interface Controller
        Parameters:
        device - the device
        tag - the tag
      • deployDevice

        public void deployDevice​(Device device,
                                 String tag)
        Description copied from interface: Controller
        Deploys device from built image.
        Specified by:
        deployDevice in interface Controller
        Parameters:
        device - the device
        tag - 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 interface Controller
        Parameters:
        device - the device
        tag - tag to be set
        monitoringIP - ip address for monitoring
        monitoringPort - 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 interface Controller
        Parameters:
        device - the device
        tag - tag to be set
        monitoringIP - ip address for monitoring
        monitoringPort - 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 interface Controller
        Parameters:
        device - the device
        file - the file
      • buildImage

        public void buildImage​(File file,
                               String tag)
        Description copied from interface: Controller
        Builds image from file.
        Specified by:
        buildImage in interface Controller
        Parameters:
        file - the image
        tag - the tag
      • findGWNetworkIPAddress

        public String findGWNetworkIPAddress​(Device device)
        Description copied from interface: Controller
        Returns network ip address of default gw.
        Specified by:
        findGWNetworkIPAddress in interface Controller
        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 interface Controller
        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 interface Controller
        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 interface Controller
        Returns:
        identifier
      • executeCommand

        public void executeCommand​(Device device,
                                   String command)
        Description copied from interface: Controller
        Executes command in device.
        Specified by:
        executeCommand in interface Controller
        Parameters:
        device - where command will be executed
        command - which will be executed
      • startDevice

        public void startDevice​(Device device)
        Description copied from interface: Controller
        Starts device.
        Specified by:
        startDevice in interface Controller
        Parameters:
        device - device to start