Connecting to the NETCONF server

A secured SSH connection between the NETCONF Client and the SLX-OS device must have been established before you can connect to the NETCONF server on the SLX-OS device.

NETCONF being a client/server protocol, requires that the client and the server exchange their capabilities. Exchanging capabilities ensures that the two devices are using the same protocols and are able to understand each other's requests.

Use these steps to create and exchange <Hello> messages between the NETCONF client and the NETCONF server.

  1. Connect to the NETCONF server using the ssh command. Pass the port number, on which the NETCONF subsystem can be found, along with the -p parameter and the sub-system to invoke, in this case NETCONF, with the -s parameter.
    ssh admin@10.10.99.99 -p 830 -s netconf
    
    <hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <capabilities>
    	<capability>urn:ietf:params:netconf:base:1.0</capability>
    	<capability>urn:ietf:params:netconf:base:1.1</capability>
    	<capability>urn:ietf:params:netconf:capability:writable-running:1.0</capability>
    	<capability>urn:ietf:params:netconf:capability:startup:1.0</capability>
    	<capability>urn:ietf:params:netconf:capability:xpath:1.0</capability>
    	<capability>urn:ietf:params:netconf:capability:validate:1.0</capability>
    	<capability>urn:ietf:params:netconf:capability:validate:1.1</capability>
    	<capability>http://tail-f.com/ns/netconf/actions/1.0</capability>
    	<capability>http://tail-f.com/ns/netconf/extensions</capability>
    	<capability>urn:ietf:params:netconf:capability:with-defaults:1.0?basic-mode=explicit&
    		also-supported=report-all-tagged</capability>
    	<capability>urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults?revision=2011-06-01&
    		module=ietf-netconf-with-defaults</capability>
    	<capability>urn:ietf:params:netconf:capability:yang-library:1.0?revision=2016-06-21&
    		module-set-id=8c12f1d15233efcda7e579aedb76bf32</capability>
    	<capability>http://extremenetworks.com/yang/extreme-bmc?module=extreme-bmc&
    		revision=2022-12-15</capability>
    	<capability>http://extremenetworks.com/yang/extreme-config-mgmt?module=extreme-config-mgmt&
    		revision=2022-11-13</capability>
    	<capability>http://extremenetworks.com/yang/extreme-gNMI?module=extreme-gNMI&
    		revision=2020-02-07</capability>
    
    	######################################
    	##### removed other capabilities #####
    	######################################
    
    	<capability>urn:brocade.com:mgmt:brocade-xstp?module=brocade-xstp&
    		revision=2018-05-23</capability>
    	<capability>urn:brocade.com:mgmt:brocade-xstp-ext?module=brocade-xstp-ext&
    		revision=2018-05-23</capability>
    	<capability>urn:brocade.com:mgmt:certutil?module=brocade-certutil&
    		revision=2018-05-23</capability>
    	<capability>urn:ietf:params:xml:ns:yang:iana-crypt-hash?module=iana-crypt-hash&
    		revision=2014-08-06&
    		features=crypt-hash-sha-512,crypt-hash-sha-256,crypt-hash-md5</capability>
    	<capability>urn:ietf:params:xml:ns:yang:ietf-inet-types?module=ietf-inet-types&
    		revision=2013-07-15</capability>
    	<capability>urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring?module=ietf-netconf-monitoring&
    		revision=2010-10-04</capability>
    	<capability>urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?module=ietf-netconf-notifications&
    		revision=2012-02-06</capability>
    	<capability>urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring?module=ietf-restconf-monitoring&
    		revision=2016-08-15</capability>
    	<capability>urn:ietf:params:xml:ns:yang:ietf-yang-library?module=ietf-yang-library&
    		revision=2016-06-21</capability>
    	<capability>urn:ietf:params:xml:ns:yang:ietf-yang-types?module=ietf-yang-types&
    		revision=2013-07-15</capability>
    </capabilities>
    <session-id>10</session-id>
    </hello>]]>]]>
    As soon as the connection is established, the server replies with its capabilities.
  2. The client sends its capabilities in another Hello message.
    <?xml version="1.0" encoding="UTF-8"?>
    <hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
      <capabilities>
        <capability>urn:ietf:params:netconf:base:1.0</capability>
      </capabilities>
    </hello>]]>]]> 

    With this message the client and server agree upon the version of NETCONF to use for communication. The client might also send other capabilities that it can support. The server uses this information when communicating with the client.

    The client must, at the least, send the supported NETCONF version number in its hello message.

  3. To test the connection, use the following XML to retrieve the clock information from the Server.
    <nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" 
    	nc:message-id="3">
       <show-clock xmlns="urn:brocade.com:mgmt:brocade-clock"></show-clock>
    </nc:rpc>]]>]]> 
  4. The following is the reply from the NETCONF server for the above test query.
    <?xml version="1.0" encoding="UTF-8"?>
    	<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" nc:message-id="3" 
    		xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
    		<clock-time xmlns='urn:brocade.com:mgmt:brocade-clock'>
    			<current-time>2024-02-15T17:24:10+00:00</current-time>
    			<timezone>Asia/Kolkata</timezone>
    		</clock-time>
    	</rpc-reply>]]>]]>