@Override public ContainerConfig getContainerConfig(String containerName) { ContainerConfig target = containerConfigs.get(containerName); return (target == null) ? null : new ContainerConfig(target); }
public List<String> pfc() { List<String> result = new ArrayList<String>(); for (Map.Entry<String, ContainerConfig> entry : containerConfigs.entrySet()) { ContainerConfig sc = entry.getValue(); result.add(String.format("%s: %s", sc.getContainerName(), sc.getContainerFlowConfigs())); } return result; }
@Override public List<String> getContainerFlowNameList(String containerName) { ContainerConfig sc = containerConfigs.get(containerName); return (sc == null) ? new ArrayList<String>(0) : sc.getContainerFlowConfigsNames(); }
/** * Checks if the proposed container configuration is valid to be applied in * terms of port sharing with other containers. * * @param containerConf * the container configuration object containing the list of node * connectors * @return the status object representing the result of the check */ private Status validatePortSharing(ContainerConfig containerConf) { return validatePortSharingInternal(containerConf.getPortList(), containerConf.getContainerFlowSpecs()); }
public List<String> psc() { List<String> result = new ArrayList<String>(); for (Map.Entry<String, ContainerConfig> entry : containerConfigs.entrySet()) { ContainerConfig sc = entry.getValue(); result.add(String.format("%s: %s", sc.getContainerName(), sc.toString())); } result.add("Total number of containers: " + containerConfigs.entrySet().size()); return result; }
: (!(status = containerConf.validate()).isSuccess()) ? String.format("Invalid %s configuration: (%s)", action, status.getDescription()) : null; if (error != null) { String containerName = containerConf.getContainerName(); if (delete) { if (!containerConfigs.containsKey(containerName)) { if (containerConf.hasFlowSpecs()) { List<ContainerFlowConfig> specList = containerConf.getContainerFlowConfigs(); if (containerConf.hasNodeConnectors()) { List<NodeConnector> ncList = containerConf.getPortList();
String containerName = containerConf.getContainer(); String groupName = containerConf.getContainerGroupName(); String containerAdminRole = containerConf.getContainerAdminRole(); String containerOperatorRole = containerConf.getContainerOperatorRole(); Set<String> allContainerSet = resourceGroups.get(allResourcesGroupName); if (delete) {
String containerName = containerConf.getContainerName(); ContainerData container = getContainerByName(containerName); if (delete && container == null) { if (containerConf.hasFlowSpecs()) { updateContainerFlow(containerName, containerConf.getContainerFlowConfigs(), delete); if (!containerConf.getPortList().isEmpty()) { updateContainerEntryDatabase(containerName, containerConf.getPortList(), delete);
Status status = ContainerConfig.validateNodeConnectors(nodeConnectorsString); if (!status.isSuccess()) { String error = String.format("Failed to apply %s: (%s)", action, status.getDescription()); List<NodeConnector> nodeConnectors = ContainerConfig.nodeConnectorsFromString(nodeConnectorsString); status = (delete) ? entryConf.removeNodeConnectors(nodeConnectorsString) : entryConf .addNodeConnectors(nodeConnectorsString); if (!status.isSuccess()) { String error = String.format("Failed to modify config for %s: (%s)", action, status.getDescription());
Status status = containerConfig.validateContainerFlowModify(cFlowConfList, delete); if (!status.isSuccess()) { String msg = status.getDescription(); status = (delete) ? containerConfig.removeContainerFlows(cFlowConfList) : containerConfig .addContainerFlows(cFlowConfList); if (!status.isSuccess()) { String error = String.format("Failed to modify config for %s: (%s)", action, status.getDescription());
@Override public List<ContainerFlowConfig> getContainerFlows(String containerName) { ContainerConfig sc = containerConfigs.get(containerName); return (sc == null) ? new ArrayList<ContainerFlowConfig>(0) : sc.getContainerFlowConfigs(); }
private void notifyContainerChangeInternal(ContainerConfig conf, UpdateType update, boolean notifyLocal) { String containerName = conf.getContainerName(); logger.trace("Notifying listeners on {} for container {}", update, containerName); // Back-end World: container name forced to lower case String container = containerName.toLowerCase(Locale.ENGLISH); boolean delete = (update == UpdateType.REMOVED); // Check if a container mode change notification is needed notifyContainerModeChange(delete, notifyLocal); // Notify listeners notifyContainerAwareListeners(container, delete); }
public void _psc(CommandInterpreter ci) { for (Map.Entry<String, ContainerConfig> entry : containerConfigs.entrySet()) { ContainerConfig sc = entry.getValue(); ci.println(String.format("%s: %s", sc.getContainerName(), sc.toString())); } ci.println("Total number of containers: " + containerConfigs.entrySet().size()); }
@Override public Map<String, List<ContainerFlowConfig>> getContainerFlows() { Map<String, List<ContainerFlowConfig>> flowSpecConfig = new HashMap<String, List<ContainerFlowConfig>>(); for (Map.Entry<String, ContainerConfig> entry : containerConfigs.entrySet()) { List<ContainerFlowConfig> set = entry.getValue().getContainerFlowConfigs(); flowSpecConfig.put(entry.getKey(), set); } return flowSpecConfig; }
public void _pfc(CommandInterpreter ci) { for (Map.Entry<String, ContainerConfig> entry : containerConfigs.entrySet()) { ContainerConfig sc = entry.getValue(); ci.println(String.format("%s: %s", sc.getContainerName(), sc.getContainerFlowConfigs())); } }
public List<String> addContainer(String arg1, String arg2) { List<String> result = new ArrayList<String>(); String containerName = arg1; if (containerName == null) { result.add("Container Name not specified"); return result; } String staticVlan = arg2; ContainerConfig containerConfig = new ContainerConfig(containerName, staticVlan, null, null); result.add((this.addRemoveContainer(containerConfig, false)).toString()); return result; }
@Override public Status removeContainerFlows(String containerName, Set<String> names) { // Construct action message String action = String.format("Flow spec(s) removal from container %s: %s", containerName, names); // Presence check ContainerConfig sc = containerConfigs.get(containerName); if (sc == null) { String msg = String.format("Container not found: %s", containerName); String error = String.format("Failed to apply %s: (%s)", action, msg); logger.warn(error); return new Status(StatusCode.NOTFOUND, msg); } List<ContainerFlowConfig> list = sc.getContainerFlowConfigs(names); if (list.isEmpty() || list.size() != names.size()) { String msg = String.format("Cannot find all the specified flow specs"); String error = String.format("Failed to apply %s: (%s)", action, msg); logger.warn(error); return new Status(StatusCode.BADREQUEST, msg); } return addRemoveContainerFlow(containerName, list, true); }
public List<String> removeContainerShell(String arg1) { List<String> result = new ArrayList<String>(); String containerName = arg1; if (containerName == null) { result.add("Container Name not specified"); return result; } ContainerConfig containerConfig = new ContainerConfig(containerName, "", null, null); result.add((this.addRemoveContainer(containerConfig, true)).toString()); return result; }
public List<String> createContainer(String arg1, String arg2) { List<String> result = new ArrayList<String>(); String containerName = arg1; if (containerName == null) { result.add("Container Name not specified"); return result; } String staticVlan = arg2; if (staticVlan == null) { result.add("Static Vlan not specified"); return result; } List<String> ports = new ArrayList<String>(); for (long l = 1L; l < 10L; l++) { ports.add(NodeConnectorCreator.createOFNodeConnector((short) 1, NodeCreator.createOFNode(l)).toString()); } List<ContainerFlowConfig> cFlowList = new ArrayList<ContainerFlowConfig>(); cFlowList.add(this.createSampleContainerFlowConfig("tcp", true)); ContainerConfig containerConfig = new ContainerConfig(containerName, staticVlan, ports, cFlowList); result.add((this.addRemoveContainer(containerConfig, false)).toString()); return result; }
public void _removeContainer(CommandInterpreter ci) { String containerName = ci.nextArgument(); if (containerName == null) { ci.print("Container Name not specified"); return; } ContainerConfig containerConfig = new ContainerConfig(containerName, "", null, null); ci.println(this.addRemoveContainer(containerConfig, true)); }