netconf-client
Version:
68 lines • 3.69 kB
TypeScript
import { Observable } from 'rxjs';
import { NamespaceType, NetconfType } from './netconf-types.ts';
/**
* Build a configuration object for Netconf edit-config RPC based on the XPath filter.
* The class takes the XPath filter and the schema observable and builds the configuration object
* that can be used in edit-config RPC.
*/
export declare class NetconfBuildConfig {
private xpath;
private schema?;
private namespace?;
private guessNamespace?;
private get hasNamespace();
/**
* Create a new BuildEditConfig object.
*
* @param {string} xpath - XPath filter of the configuration object,
* for example, //interfaces/interface[name="eth1"]
* @param {Observable<NetconfType>} schema - Observable that emits the schema of the device.
* The class may use it if the XPath filter is not straightforward.
* @param {string | (string | NamespaceType)[]} namespace - Optional target namespace for the configuration object.
* it can also be an array of namespaces with their aliases, see {@link NamespaceType}.
*/
constructor(xpath: string, schema?: Observable<NetconfType>, namespace?: string | (string | NamespaceType)[], guessNamespace?: Observable<string | undefined>);
/**
* Build a configuration object for Netconf edit-config RPC. The function will return an array of configuration
* objects, that is, the object where configuration must be updated according to the xpath filter.
* For example, if Xpath filter is //interfaces/interface[name="eth1"], the function will return an array of
* objects, containing the interface with name eth1 (array of one object).
*
* @param {NetconfType} targetObj - The root configuration object from which to build the configuration based
* on the XPath filter.
*
* @returns {NetconfType[]} Array of objects where configuration must be updated, for example,
* for the XPath //interfaces/interface[name="eth1"], the function will return an array of one object
* containing the interface with name eth1. The returned objects are nested in the targetObj.
* The function returns an empty array if:
* - the schema is not provided.
* - the XPath filter cannot be matched with schema of XPath
*/
build(targetObj: NetconfType): Observable<NetconfType[]>;
/**
* Build a configuration object for Netconf edit-config RPC based on the XPath filter. The function will
* attempt to build the configuration object from the XPath provided. If the XPath has features not supported
* by the function, the function will return undefined. The function only supports full XPath with
* predicates for matching nodes.
*
* @param {NetconfType} targetObj - The root configuration object from which to build the configuration based
* on the XPath filter.
*
* @returns {NetconfType[] | undefined} Array including the configuration object that needs to be updated.
*/
private buildFromXPath;
/**
* Build a configuration object for Netconf edit-config RPC based on the schema. The function will
* request the schema from the server using the xpath filter and build the configuration object based on the schema.
*
* @param {NetconfType} targetObj - The root configuration object from which to build the configuration based
* on the XPath filter.
*
* @returns {NetconfType[]} Array of objects where configuration must be updated.
*/
private buildFromSchema;
private findConfigPartsInSchema;
private stripNestedObjects;
private getNamespaces;
}
//# sourceMappingURL=netconf-build-config.d.ts.map