napalm_yang/base.py
def parse_state(self, device=None, profile=None, native=None, attrs=None):
        """
        Parse native state and load it into the corresponding models. Only models
        that have been added to the root object will be parsed.

        If ``native`` is passed to the method that's what we will parse, otherwise, we will use the
        ``device`` to retrieve it.

        Args:
            device (NetworkDriver): Device to load the configuration from.
            profile (list): Profiles that the device supports. If no ``profile`` is passed it will
              be read from ``device``.
            native (list string): Native output to parse.

        Examples:

            >>> # Load from device
            >>> state = napalm_yang.base.Root()
            >>> state.add_model(napalm_yang.models.openconfig_interfaces)
            >>> state.parse_config(device=d)

            >>> # Load from file
            >>> with open("junos.state", "r") as f:
            >>>     state_data = f.read()
            >>>
            >>> state = napalm_yang.base.Root()
            >>> state.add_model(napalm_yang.models.openconfig_interfaces)
            >>> state.parse_config(native=[state_data], profile="junos")
        """
        if attrs is None:
            attrs = self.elements().values()

        for v in attrs:
            parser = Parser(
                v, device=device, profile=profile, native=native, is_config=False
            )
            parser.parse()
def parse_state(self, device=None, profile=None, native=None, attrs=None):
        if attrs is None:
            attrs = self.elements().values()

        for v in attrs:
            parser = Parser(
                v, device=device, profile=profile, native=native, is_config=False
            )
            parser.parse()
def parse_state ( self , device = None , profile = None , native = None , attrs = None ) : if attrs is None : attrs = self . elements ( ) . values ( ) for v in attrs : parser = Parser ( v , device = device , profile = profile , native = native , is_config = False ) parser . parse ( )
Parse native state and load it into the corresponding models. Only models
        that have been added to the root object will be parsed.

        If ``native`` is passed to the method that's what we will parse, otherwise, we will use the
        ``device`` to retrieve it.

        Args:
            device (NetworkDriver): Device to load the configuration from.
            profile (list): Profiles that the device supports. If no ``profile`` is passed it will
              be read from ``device``.
            native (list string): Native output to parse.

        Examples:

            >>> # Load from device
            >>> state = napalm_yang.base.Root()
            >>> state.add_model(napalm_yang.models.openconfig_interfaces)
            >>> state.parse_config(device=d)

            >>> # Load from file
            >>> with open("junos.state", "r") as f:
            >>>     state_data = f.read()
            >>>
            >>> state = napalm_yang.base.Root()
            >>> state.add_model(napalm_yang.models.openconfig_interfaces)
            >>> state.parse_config(native=[state_data], profile="junos")
Parse native state and load it into the corresponding models . Only models that have been added to the root object will be parsed .