private ContainerFlowConfig createSampleContainerFlowConfig(String cflowName, boolean boolUnidirectional) { ContainerFlowConfig cfg = new ContainerFlowConfig(cflowName, "9.9.1.0/24", "19.9.1.2", "TCP", "1234", "25"); return cfg; }
/** * 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); }
private void notifyCFlowChangeInternal(String containerName, List<ContainerFlowConfig> confList, UpdateType update, boolean notifyLocal) { logger.trace("Notifying listeners on {} for flow specs {} in container {}", update, confList, containerName); // Back-end World: container name forced to lower case String container = containerName.toLowerCase(Locale.ENGLISH); for (ContainerFlowConfig conf : confList) { for (Match match : conf.getMatches()) { ContainerFlow cFlow = new ContainerFlow(match); synchronized (this.iContainerListener) { for (IContainerListener i : this.iContainerListener) { i.containerFlowUpdated(container, cFlow, cFlow, update); } } // Check if the Functional Modules need to be notified as well if (notifyLocal) { synchronized (this.iContainerLocalListener) { for (IContainerLocalListener i : this.iContainerLocalListener) { i.containerFlowUpdated(container, cFlow, cFlow, update); } } } } } }
for (Match match : conf.getMatches()) { ContainerFlow cFlow = new ContainerFlow(match); status = validateContainerFlowAddRemoval(containerName, cFlow, delete);