NETCONF Device Commands¶
This section shows the XML payloads generated by each NETCONF device driver
for each supported operation. The XML is rendered with example values
(VLAN 100, port Ethernet1/1) to illustrate the OpenConfig structure sent
to the switch via edit-config.
NetconfOpenConfigSwitch (netconf_openconfig)¶
NETCONF OpenConfig switch driver.
Manages network and port operations using OpenConfig YANG models
over NETCONF transport. Callable class variables (ADD_NETWORK,
DELETE_NETWORK, ADD_NETWORK_TO_TRUNK, REMOVE_NETWORK_FROM_TRUNK,
PLUG_PORT_TO_NETWORK, DELETE_PORT, ENABLE_PORT, DISABLE_PORT) build
OpenConfig model objects that the base class serialises to XML and
pushes via send_config_to_device.
ADD_NETWORK¶
Create a VLAN on the device
<config>
<network-instances xmlns="http://openconfig.net/yang/network-instance">
<network-instance>
<name>default</name>
<vlans xmlns="http://openconfig.net/yang/vlan">
<vlan>
<vlan-id operation="merge">100</vlan-id>
<config operation="merge">
<vlan-id>100</vlan-id>
<name>aabbccdd11223344aabbccdd11223344</name>
<status>ACTIVE</status>
</config>
</vlan>
</vlans>
</network-instance>
</network-instances>
</config>
DELETE_NETWORK¶
Remove a VLAN from the device
<config>
<network-instances xmlns="http://openconfig.net/yang/network-instance">
<network-instance>
<name>default</name>
<vlans xmlns="http://openconfig.net/yang/vlan">
<vlan>
<vlan-id operation="remove">100</vlan-id>
<config operation="merge">
<vlan-id>100</vlan-id>
<name>neutron-DELETED-100</name>
<status>SUSPENDED</status>
</config>
</vlan>
</vlans>
</network-instance>
</network-instances>
</config>
ADD_NETWORK_TO_TRUNK¶
Tag trunk ports with a VLAN when a network is created
<config>
<interfaces xmlns="http://openconfig.net/yang/interfaces">
<interface>
<name>Ethernet1/48</name>
<config/>
<ethernet xmlns="http://openconfig.net/yang/interfaces/ethernet">
<config operation="merge"/>
<switched-vlan xmlns="http://openconfig.net/yang/vlan">
<config operation="merge">
<trunk-vlans>100</trunk-vlans>
<interface-mode>TRUNK</interface-mode>
</config>
</switched-vlan>
</ethernet>
</interface>
</interfaces>
</config>
REMOVE_NETWORK_FROM_TRUNK¶
Untag trunk ports when a network is deleted
<config>
<interfaces xmlns="http://openconfig.net/yang/interfaces">
<interface>
<name>Ethernet1/48</name>
<config/>
<ethernet xmlns="http://openconfig.net/yang/interfaces/ethernet">
<config operation="merge"/>
<switched-vlan xmlns="http://openconfig.net/yang/vlan">
<config operation="merge">
<trunk-vlans operation="remove">100</trunk-vlans>
<interface-mode>TRUNK</interface-mode>
</config>
</switched-vlan>
</ethernet>
</interface>
</interfaces>
</config>
PLUG_PORT_TO_NETWORK¶
Assign an access VLAN to a port
<config>
<interfaces xmlns="http://openconfig.net/yang/interfaces">
<interface>
<name>Ethernet1/1</name>
<config/>
<ethernet xmlns="http://openconfig.net/yang/interfaces/ethernet">
<config operation="merge"/>
<switched-vlan xmlns="http://openconfig.net/yang/vlan">
<config operation="replace">
<access-vlan>100</access-vlan>
<interface-mode>ACCESS</interface-mode>
</config>
</switched-vlan>
</ethernet>
</interface>
</interfaces>
</config>
DELETE_PORT¶
Remove VLAN configuration from a port
<config>
<interfaces xmlns="http://openconfig.net/yang/interfaces">
<interface>
<name>Ethernet1/1</name>
<config>
<description operation="remove"/>
</config>
<ethernet xmlns="http://openconfig.net/yang/interfaces/ethernet">
<config operation="merge"/>
<switched-vlan xmlns="http://openconfig.net/yang/vlan">
<config operation="remove"/>
</switched-vlan>
</ethernet>
</interface>
</interfaces>
</config>
ENABLE_PORT¶
Administratively enable a port
<config>
<interfaces xmlns="http://openconfig.net/yang/interfaces">
<interface>
<name>Ethernet1/1</name>
<config>
<enabled operation="merge">true</enabled>
</config>
<ethernet xmlns="http://openconfig.net/yang/interfaces/ethernet">
<config operation="merge"/>
<switched-vlan xmlns="http://openconfig.net/yang/vlan">
<config operation="merge"/>
</switched-vlan>
</ethernet>
</interface>
</interfaces>
</config>
DISABLE_PORT¶
Administratively disable a port
<config>
<interfaces xmlns="http://openconfig.net/yang/interfaces">
<interface>
<name>Ethernet1/1</name>
<config>
<enabled operation="merge">false</enabled>
</config>
<ethernet xmlns="http://openconfig.net/yang/interfaces/ethernet">
<config operation="merge"/>
<switched-vlan xmlns="http://openconfig.net/yang/vlan">
<config operation="merge"/>
</switched-vlan>
</ethernet>
</interface>
</interfaces>
</config>