@Override public ContainerData getContainerData(String containerName) { return (getContainerByName(containerName)); }
@Override public boolean doesContainerExist(String containerName) { // Test for default container if (GlobalConstants.DEFAULT.toString().equalsIgnoreCase(containerName)) { return true; } // Test for non-default one return (getContainerByName(containerName) != null); }
/** * Checks if the passed list of node connectors can be safely applied to the * specified existing container in terms of port sharing with other containers. * * @param containerName * the name of the existing container * @param portList * the list of node connectors to be added to the container * @return the status object representing the result of the check */ private Status validatePortSharing(String containerName, List<NodeConnector> portList) { ContainerData container = this.getContainerByName(containerName); if (container == null) { String error = String .format("Cannot validate port sharing for container %s: (container does not exist)", containerName); logger.error(error); return new Status(StatusCode.BADREQUEST, error); } return validatePortSharingInternal(portList, container.getContainerFlowSpecs()); }
ContainerData container = getContainerByName(containerName);
ContainerData container = this.getContainerByName(containerName); if (container == null) { String error = String.format("Cannot validate flow specs for container %s: (Container does not exist)", containerName);
/** * Adds/Remove the list of flow specs to/from the specified container. This * function is supposed to be called after all the validation checks have * already been run on the proposed configuration. */ private Status updateContainerFlow(String containerName, List<ContainerFlowConfig> confList, boolean delete) { ContainerData container = getContainerByName(containerName); if (container == null) { return new Status(StatusCode.GONE, "Container not present"); } for (ContainerFlowConfig conf : confList) { // Validation was fine. Modify the database now. for (Match match : conf.getMatches()) { ContainerFlow cFlow = new ContainerFlow(match); if (delete) { logger.trace("Removing Flow Spec {} from Container {}", conf.getName(), containerName); container.deleteFlowSpec(cFlow); } else { logger.trace("Adding Flow Spec {} to Container {}", conf.getName(), containerName); container.addFlowSpec(cFlow); } // Update Database putContainerDataByName(containerName, container); } } return new Status(StatusCode.SUCCESS); }
ContainerData container = getContainerByName(containerName); if (delete && container == null) { return new Status(StatusCode.NOTFOUND, "Container is not present");