+
+ Description description = (Description) switchConfig.getProperty(Description.propertyName);
+ String nodeId = switchConfig.getNodeId();
+ Node node = Node.fromString(nodeId);
+ NodeDescription nodeDesc = (this.statisticsManager == null) ? null : this.statisticsManager
+ .getNodeDescription(node);
+ String advertisedDesc = (nodeDesc == null) ? "" : nodeDesc.getDescription();
+ if (description != null && description.getValue() != null) {
+ if (description.getValue().isEmpty() || description.getValue().equals(advertisedDesc)) {
+ updateProperties.remove(Description.propertyName);
+ switchConfig = new SwitchConfig(nodeId, updateProperties);
+ } else {
+ // check if description is configured or was published by any other node
+ for (Map.Entry<Node, Map<String, Property>> entry : nodeProps.entrySet()) {
+ Node n = entry.getKey();
+ Description desc = (Description) getNodeProp(n, Description.propertyName);
+ NodeDescription nDesc = (this.statisticsManager == null) ? null : this.statisticsManager
+ .getNodeDescription(n);
+ String advDesc = (nDesc == null) ? "" : nDesc.getDescription();
+ if ((description.equals(desc) || description.getValue().equals(advDesc)) && !node.equals(n)) {
+ return new Status(StatusCode.CONFLICT, "Node name already in use");
+ }
+ }
+ }
+ }
+