use of org.opendaylight.controller.config.facade.xml.strategy.EditStrategyType in project controller by opendaylight.
the class InstanceConfigElementResolved method parseStrategy.
static EditStrategyType parseStrategy(final String currentStrategy, final EditStrategyType defaultStrategy) throws OperationNotPermittedException {
EditStrategyType parsedStrategy = EditStrategyType.valueOf(currentStrategy);
EditStrategyType.compareParsedStrategyToDefaultEnforcing(parsedStrategy, defaultStrategy);
return parsedStrategy;
}
use of org.opendaylight.controller.config.facade.xml.strategy.EditStrategyType in project controller by opendaylight.
the class Config method fromXmlModulesResolved.
// TODO refactor, replace string representing namespace with namespace class
// TODO refactor, replace Map->Multimap with e.g. ConfigElementResolved
// class
public Map<String, Multimap<String, ModuleElementResolved>> fromXmlModulesResolved(final XmlElement xml, final EditStrategyType defaultEditStrategyType, final ServiceRegistryWrapper serviceTracker) throws DocumentedException {
Optional<XmlElement> modulesElement = getModulesElement(xml);
List<XmlElement> moduleElements = getModulesElementList(modulesElement);
Map<String, Multimap<String, ModuleElementResolved>> retVal = Maps.newHashMap();
ResolvingStrategy<ModuleElementResolved> resolvingStrategy = (moduleMapping, moduleElement, serviceTracker1, instanceName, moduleNamespace, defaultStrategy) -> moduleMapping.fromXml(moduleElement, serviceTracker1, instanceName, moduleNamespace, defaultStrategy, identityMap, enumResolver);
for (XmlElement moduleElement : moduleElements) {
resolveModule(retVal, serviceTracker, moduleElement, defaultEditStrategyType, resolvingStrategy);
}
return retVal;
}
use of org.opendaylight.controller.config.facade.xml.strategy.EditStrategyType in project controller by opendaylight.
the class Config method fromXmlModulesMap.
/**
* return a map containing namespace -> moduleName -> instanceName map.
* Attribute parsing is omitted.
*/
public Map<String, Multimap<String, ModuleElementDefinition>> fromXmlModulesMap(final XmlElement xml, final EditStrategyType defaultEditStrategyType, final ServiceRegistryWrapper serviceTracker) throws DocumentedException {
Optional<XmlElement> modulesElement = getModulesElement(xml);
List<XmlElement> moduleElements = getModulesElementList(modulesElement);
Map<String, Multimap<String, ModuleElementDefinition>> retVal = Maps.newHashMap();
ResolvingStrategy<ModuleElementDefinition> resolvingStrategy = (moduleMapping, moduleElement, serviceTracker1, instanceName, moduleNamespace, defaultStrategy) -> {
// TODO: add check for conflicts between global and local edit
// strategy
String perInstanceEditStrategy = moduleElement.getAttribute(XmlMappingConstants.OPERATION_ATTR_KEY, XmlMappingConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
return new ModuleElementDefinition(instanceName, perInstanceEditStrategy, defaultStrategy);
};
for (XmlElement moduleElement : moduleElements) {
resolveModule(retVal, serviceTracker, moduleElement, defaultEditStrategyType, resolvingStrategy);
}
return retVal;
}
use of org.opendaylight.controller.config.facade.xml.strategy.EditStrategyType in project controller by opendaylight.
the class ArrayAttributeReadingStrategy method readElementHook.
@Override
AttributeConfigElement readElementHook(final List<XmlElement> configNodes) throws DocumentedException {
List<Object> innerList = Lists.newArrayList();
EditStrategyType innerEditStrategy = null;
for (XmlElement configNode : configNodes) {
final AttributeConfigElement attributeConfigElement = innerStrategy.readElement(Lists.newArrayList(configNode));
if (attributeConfigElement.getEditStrategy().isPresent()) {
// TODO this sets the last operation for the entire array
innerEditStrategy = attributeConfigElement.getEditStrategy().get();
}
innerList.add(attributeConfigElement.getValue());
}
return innerEditStrategy == null ? AttributeConfigElement.create(getNullableDefault(), innerList) : AttributeConfigElement.create(getNullableDefault(), innerList, innerEditStrategy);
}
Aggregations