Class YangXmlUtils


  • public class YangXmlUtils
    extends Object
    Util CLass for Yang models. Clean abstraction to read, obtain and populate XML from Yang models translated into XML skeletons.
    • Field Detail

      • log

        public final org.slf4j.Logger log
    • Constructor Detail

      • YangXmlUtils

        protected YangXmlUtils()
    • Method Detail

      • getXmlConfiguration

        public org.apache.commons.configuration.XMLConfiguration getXmlConfiguration​(String file,
                                                                                     Map<String,​String> values)
        Retrieves a valid XML configuration for a specific XML path for a single instance of the Map specified key-value pairs.
        Parameters:
        file - path of the file to be used.
        values - map of key and values to set under the generic path.
        Returns:
        Hierarchical configuration containing XML with values.
      • getXmlConfiguration

        public org.apache.commons.configuration.XMLConfiguration getXmlConfiguration​(String file,
                                                                                     List<YangElement> elements)
        Retrieves a valid XML configuration for a specific XML path for multiple instance of YangElements objects.
        Parameters:
        file - path of the file to be used.
        elements - List of YangElements that are to be set.
        Returns:
        Hierachical configuration containing XML with values.
      • readXmlConfiguration

        public List<YangElement> readXmlConfiguration​(org.apache.commons.configuration.HierarchicalConfiguration cfg,
                                                      String path)
        Reads a valid XML configuration and returns a Map containing XML field name. and value contained for every subpath.
        Parameters:
        cfg - the Configuration to read.
        path - path of the information to be read.
        Returns:
        list of elements containing baskey and map of key value pairs.
      • getInstance

        public static YangXmlUtils getInstance()
        Single Instance of Yang utilities retriever.
        Returns:
        instance of YangXmlUtils
      • getString

        public String getString​(org.apache.commons.configuration.XMLConfiguration cfg)
        Return the string representation of the XMLConfig without header and configuration element.
        Parameters:
        cfg - the XML to convert
        Returns:
        the cfg string.
      • loadXml

        public org.apache.commons.configuration.XMLConfiguration loadXml​(InputStream xmlStream)
        Method to read an input stream into a XMLConfiguration.
        Parameters:
        xmlStream - inputstream containing XML description
        Returns:
        the XMLConfiguration object