- private static class NetconfOperationExecution {
-
- private final ObjectName on;
- private final String operationName;
- private final Map<String, AttributeConfigElement> attributes;
- private final AttributeIfc returnType;
- private final String namespace;
-
- public NetconfOperationExecution(final ObjectName on, final String name,
- final Map<String, AttributeConfigElement> attributes, final AttributeIfc returnType, final String namespace) {
- this.on = on;
- this.operationName = name;
- this.attributes = attributes;
- this.returnType = returnType;
- this.namespace = namespace;
- }
-
- boolean isVoid() {
- return returnType == VoidAttribute.getInstance();
- }
-
- }
-
- private static Map<String, AttributeConfigElement> sortAttributes(
- final Map<String, AttributeConfigElement> attributes, final XmlElement xml) {
- final Map<String, AttributeConfigElement> sorted = Maps.newLinkedHashMap();
-
- for (XmlElement xmlElement : xml.getChildElements()) {
- final String name = xmlElement.getName();
- if (!CONTEXT_INSTANCE.equals(name)) { // skip context
- // instance child node
- // because it
- // specifies
- // ObjectName
- final AttributeConfigElement value = attributes.get(name);
- if (value == null) {
- throw new IllegalArgumentException("Cannot find yang mapping for node " + xmlElement);
- }
- sorted.put(name, value);
- }
- }
-
- return sorted;
- }
-
- private static Rpcs mapRpcs(final Map<String, Map<String, ModuleMXBeanEntry>> mBeanEntries) {
-
- final Map<String, Map<String, ModuleRpcs>> map = Maps.newHashMap();
-
- for (final String namespace : mBeanEntries.keySet()) {
-
- Map<String, ModuleRpcs> namespaceToModules = map.get(namespace);
- if (namespaceToModules == null) {
- namespaceToModules = Maps.newHashMap();
- map.put(namespace, namespaceToModules);
- }
-
- for (final String moduleName : mBeanEntries.get(namespace).keySet()) {
-
- ModuleRpcs rpcMapping = namespaceToModules.get(moduleName);
- if (rpcMapping == null) {
- rpcMapping = new ModuleRpcs();
- namespaceToModules.put(moduleName, rpcMapping);
- }
-
- final ModuleMXBeanEntry entry = mBeanEntries.get(namespace).get(moduleName);
-
- for (final RuntimeBeanEntry runtimeEntry : entry.getRuntimeBeans()) {
- rpcMapping.addNameMapping(runtimeEntry);
- for (final Rpc rpc : runtimeEntry.getRpcs()) {
- rpcMapping.addRpc(runtimeEntry, rpc);
- }
- }
- }
- }
-
- return new Rpcs(map);
- }
-