No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

S600-E V200R011C10 NETCONF YANG API Reference

This document describes the NETCONF API functions supported by the switch, including the data model and samples.
Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Log Management

Log Management

This section describes the configuration model of log management and provides examples of XML packets.

Data Model

The configuration model file matching log management is ietf-syslog.yang.

Table 2-75  Log management configuration

Object

Description

Value Remarks

/ietf-syslog:syslog/log-actions/remote/destination/udp/address

Indicates the address of a log host.

The value is a character string:
  • ipv4-address: specifies the IPv4 address of a log host. The value is in dotted decimal notation.
  • ipv6-address: specifies the IPv6 address of a log host. The value is a 32-digit hexadecimal number.
  • domain-name: specifies the domain name of a log host. The value is a string of 1 to 255 case-sensitive characters without spaces.

NA

/ietf-syslog:syslog/log-actions/remote/destination/udp/port

Indicates the port number of a log host.

The value is an integer that ranges from 1 to 65535.

NA

/ietf-syslog:syslog/log-actions/remote/destination/destination-facility

Indicates the logging tool of a log host.

The value is a character string that ranges from local0 to local7.

NA

/ietf-syslog:syslog/log-actions/remote/destination/source-interface

Indicates the source interface used to send logs to a log host.

The value is a character string and must be an existing interface.

NA

Configuring a Log Host

This section describes how to configure a log host using the config method.

Table 2-76  Configuring a log host

Operation

XPATH

edit-config:config

/ietf-syslog:syslog/log-actions/remote/destination

Data requirement 1

Table 2-77  Configuring the log host address format as a domain name

Item

Data

Description

Address of a log host

huawei

Indicates that the configured log host address is a domain name.

Port number of a log host

43

Indicates the configured port number of a log host.

Logging tool of a log host

local0

Indicates the configured logging tool of a log host.

Source interface used to send logs to a log host

GigabitEthernet0/0/1

Indicates the configured source interface used to send logs to a log host.

Ensure that this interface exists and has been configured on the device. For details about the configuration, see Configuring Basic Attributes of an Interface.

Request example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="3" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
      <syslog:syslog xmlns:syslog="urn:ietf:params:xml:ns:yang:ietf-syslog">
        <syslog:log-actions>
          <syslog:remote>
            <syslog:destination>
              <syslog:name>NEED-A-VALUE-FOR-KEY-NODE!</syslog:name>
              <syslog:udp>
                <syslog:address>huawei</syslog:address>
                <syslog:port>43</syslog:port>
              </syslog:udp>
              <syslog:destination-facility>local0</syslog:destination-facility>
              <syslog:source-interface>GigabitEthernet0/0/1</syslog:source-interface>
            </syslog:destination>
          </syslog:remote>
        </syslog:log-actions>
      </syslog:syslog>
    </config>
  </edit-config>
</rpc>

Response example

Sample of successful response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="8">
  <ok/>
</rpc-reply>

Sample of failed response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="9">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>parse rpc config error.</error-message>
  </rpc-error>
</rpc-reply>

Data requirement 2

Table 2-78  Configuring the log host address as an IPv6 address.

Item

Data

Description

Address of a log host

fc00:0:0:3001::1

Indicates that the configured log host address is an IPv6 address.

Port number of a log host

43

Indicates the configured port number of a log host.

Logging tool of a log host

local0

Indicates the configured logging tool of a log host.

Source interface used to send logs to a log host

GigabitEthernet0/0/1

Indicates the configured source interface used to send logs to a log host.

Request example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="9" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
      <syslog:syslog xmlns:syslog="urn:ietf:params:xml:ns:yang:ietf-syslog">
        <syslog:log-actions>
          <syslog:remote>
            <syslog:destination>
              <syslog:name>NEED-A-VALUE-FOR-KEY-NODE!</syslog:name>
              <syslog:udp>
                <syslog:address>fc00:0:0:3001::1</syslog:address>
                <syslog:port>43</syslog:port>
              </syslog:udp>
              <syslog:destination-facility>local0</syslog:destination-facility>
              <syslog:source-interface>GigabitEthernet0/0/1</syslog:source-interface>
            </syslog:destination>
          </syslog:remote>
        </syslog:log-actions>
      </syslog:syslog>
    </config>
  </edit-config>
</rpc>

Response example

Sample of successful response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="8">
  <ok/>
</rpc-reply>

Sample of failed response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="9">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>parse rpc config error.</error-message>
  </rpc-error>
</rpc-reply>

Data requirement 3

Table 2-79  Changing the log host address to an IPv4 address

Item

Data

Description

Address of a log host

192.168.1.5

Indicates that the configured log host address is an IPv4 address.

Port number of a log host

43

Indicates the configured port number of a log host.

Logging tool of a log host

local0

Indicates the configured logging tool of a log host.

Source interface used to send logs to a log host

GigabitEthernet0/0/1

Indicates the configured source interface used to send logs to a log host.

Replacement example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="4" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
      <syslog:syslog xmlns:syslog="urn:ietf:params:xml:ns:yang:ietf-syslog">
        <syslog:log-actions>
          <syslog:remote>
            <syslog:destination>
              <syslog:name>NEED-A-VALUE-FOR-KEY-NODE!</syslog:name>
              <syslog:udp>
                <syslog:address xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="replace">192.168.1.5</syslog:address>
                <syslog:port>43</syslog:port>
              </syslog:udp>
              <syslog:destination-facility>local0</syslog:destination-facility>
              <syslog:source-interface>GigabitEthernet0/0/1</syslog:source-interface>
            </syslog:destination>
          </syslog:remote>
        </syslog:log-actions>
      </syslog:syslog>
    </config>
  </edit-config>
</rpc>

Response example

Sample of successful response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="8">
  <ok/>
</rpc-reply>

Sample of failed response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="9">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>parse rpc config error.</error-message>
  </rpc-error>
</rpc-reply>

Data requirement 4

Table 2-80  Deleting the log host configuration

Item

Data

Description

Address of a log host

192.168.1.5

Indicates that the deleted log host address is an IPv4 address.

Port number of a log host

43

Indicates the deleted port number of a log host.

Logging tool of a log host

local0

Indicates the deleted logging tool of a log host.

Source interface used to send logs to a log host

GigabitEthernet0/0/1

Indicates the deleted source interface used to send logs to a log host.

Deletion example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="7" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
      <syslog:syslog xmlns:syslog="urn:ietf:params:xml:ns:yang:ietf-syslog">
        <syslog:log-actions>
          <syslog:remote>
            <syslog:destination xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete">
              <syslog:name>NEED-A-VALUE-FOR-KEY-NODE!</syslog:name>
              <syslog:udp>
                <syslog:address>192.168.1.5</syslog:address>
                <syslog:port>43</syslog:port>
              </syslog:udp>
              <syslog:destination-facility>local0</syslog:destination-facility>
              <syslog:source-interface>GigabitEthernet0/0/1</syslog:source-interface>
            </syslog:destination>
          </syslog:remote>
        </syslog:log-actions>
      </syslog:syslog>
    </config>
  </edit-config>
</rpc>

Response example

Sample of successful response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="8">
  <ok/>
</rpc-reply>

Sample of failed response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="9">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>parse rpc config error.</error-message>
  </rpc-error>
</rpc-reply>
Translation
Download
Updated: 2019-10-18

Document ID: EDOC1000178028

Views: 5009

Downloads: 0

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next