设备驱动 - netconf-openconfig

netconf-openconfig 设备驱动程序使用网络配置协议 (NETCONF) 和开源厂商中立的 OpenConfig YANG 模型。

该驱动程序已与以下交换机厂商/操作系统进行测试

  • Cisco NXOS

  • Arista vEOS

Cisco NXOS 设备的示例配置:

[networking_baremetal]
enabled_devices = nexus.example.net

[nexus.example.net]
driver = netconf-openconfig
device_params = name:nexus
switch_info = nexus
switch_id = 00:53:00:0a:0a:0a
host = nexus.example.net
username = user
key_filename = /etc/neutron/ssh_keys/nexus_sshkey

Arista EOS 设备的示例配置:

[networking_baremetal]
enabled_devices = arista.example.net

[arista.example.net]
driver = netconf-openconfig
device_params = name:default
switch_info = arista
switch_id = 00:53:00:0b:0b:0b
host = arista.example.net
username = user
key_filename = /etc/neutron/ssh_keys/arista_sshkey

配置选项

netconf-openconfig-example

driver
类型:

字符串

默认值:

<None>

配置设备时使用的驱动程序

switch_id
类型:

字符串

默认值:

<None>

交换机 ID,设备的 MAC 地址。

switch_info
类型:

字符串

默认值:

<None>

可选字符串字段,用于存储任何特定于厂商的信息。

physical_networks
类型:

列表

默认值:

[]

映射到此设备的物理网络列表。

manage_vlans
类型:

布尔值

默认值:

True

如果设备上不应创建和删除 VLAN,请将其设置为 False。

network_instance
类型:

字符串

默认值:

default

高级选项:

供高级用户使用,大多数用户不使用,并且可能对稳定性和/或性能产生重大影响。

在设备上定义 VLAN 时使用的 L2、L3 或 L2+L3 转发实例。

port_id_re_sub
类型:

dict

默认值:

{'pattern': 'Ethernet', 'repl': 'eth'}

此选项有一个示例默认值,这意味着其实际默认值可能与上述文档值不同。

正则表达式模式和替换字符串。 某些设备在 Netconf 配置中不使用 LLDP 端口描述。 如果设置了正则表达式模式和替换字符串,则在将配置传递到设备之前将修改 port_id。

disabled_properties
类型:

列表

默认值:

[]

应禁用属性的列表,目前只有“port_mtu”有效

manage_lacp_aggregates
类型:

布尔值

默认值:

True

如果将此设置为 true,则驱动程序将在 binding:profile 中定义 link_group_information 时管理 LACP 聚合。 如果为 false,则驱动程序期望链路聚合在设备上预先配置,并且仅执行 VLAN 插拔。

类型:

字符串

默认值:

Port-Channel

用于链路聚合端口的设备特定前缀。 常见值:“po”、“port-channel”或“Port-Channel”。

类型:

字符串

默认值:

1000..2000

驱动程序在管理链路聚合时可以使用链路聚合接口 ID 的范围。

host
类型:

字符串

默认值:

device.example.com

此选项有一个示例默认值,这意味着其实际默认值可能与上述文档值不同。

用于连接到 netconf 设备的hostname 或 IP 地址。

username
类型:

字符串

默认值:

netconf

此选项有一个示例默认值,这意味着其实际默认值可能与上述文档值不同。

用于 SSH 身份验证的用户名。

port
类型:

整数

默认值:

830

用于连接到 netconf 设备的端口。

password
类型:

字符串

默认值:

secret

此选项有一个示例默认值,这意味着其实际默认值可能与上述文档值不同。

如果使用密码身份验证,则使用的密码,或者用于解锁需要它的密钥的密码短语。(要完全禁用尝试密钥身份验证,请将选项allow_agentlook_for_keys设置为False。)

key_filename
类型:

字符串

默认值:

~/.ssh/id_rsa

私钥文件名

hostkey_verify
类型:

布尔值

默认值:

True

启用从 ~/.ssh/known_hosts 验证主机密钥

device_params
类型:

dict

默认值:

{'name': 'default'}

ncclient 设备处理程序参数,请参阅 ncclient 文档以获取支持的设备处理程序。

allow_agent
类型:

布尔值

默认值:

True

启用查询 SSH 代理(如果找到)以获取密钥。

look_for_keys
类型:

布尔值

默认值:

True

启用在通常的位置查找 ssh 密钥(例如 ~/.ssh/id_*

networking_baremetal

enabled_devices
类型:

列表

默认值:

['common-example', 'netconf-openconfig-example']

此选项有一个示例默认值,这意味着其实际默认值可能与上述文档值不同。

启用插件应管理配置的设备。 每个设备的驱动程序特定配置必须添加到单独的部分中。

示例配置文件

以下是将在 /etc/neutron/plugins/ml2/ml2_conf.ini 中添加的示例配置部分。

示例配置也可以在 file form 中查看。

重要提示

示例配置文件是在构建此文档时从 networking-baremetal 自动生成的。您必须确保您的 networking-baremetal 版本与此文档的版本匹配。

[DEFAULT]


[netconf-openconfig-example]

#
# From netconf-openconfig-driver-opts
#

# The driver to use when configuring the device (string value)
#driver = <None>

# The switch ID, MAC address of the device. (string value)
#switch_id = <None>

# Optional string field to be used to store any vendor-specific information.
# (string value)
#switch_info = <None>

# A list of physical networks mapped to this device. (list value)
#physical_networks =

# Set this to False for the device if VLANs should not be create and deleted on
# the device. (boolean value)
#manage_vlans = true

# Regular expression pattern and replacement string. Some devices do not use
# the port description from LLDP in Netconf configuration. If the regular
# expression pattern and replacement string is set the port_id will be modified
# before passing configuration to the device. (dict value)
#
# This option has a sample default set, which means that
# its actual default value may vary from the one documented
# below.
#port_id_re_sub = pattern:Ethernet,repl:eth

# A list of properties that should not be used, currently only "port_mtu" is
# valid (list value)
#disabled_properties =

# When set to true the driver will manage LACP aggregates if
# link_group_information is defined in the binding:profile. When this is false
# the driver expect the link aggregation to be pre-configured on the device,
# and only perform vlan plugging. (boolean value)
#manage_lacp_aggregates = true

# The device specific prefix used for link-aggregation ports. Common values:
# "po", "port-channel" or "Port-Channel". (string value)
#link_aggregate_prefix = Port-Channel

# Range of link aggregation interface IDs that the driver can use when managing
# link aggregates. (string value)
#link_aggregate_range = 1000..2000

# The hostname or IP address to use for connecting to the netconf device.
# (string value)
#
# This option has a sample default set, which means that
# its actual default value may vary from the one documented
# below.
#host = device.example.com

# The username to use for SSH authentication. (string value)
#
# This option has a sample default set, which means that
# its actual default value may vary from the one documented
# below.
#username = netconf

# The port to use for connection to the netconf device. (integer value)
#port = 830

# The password used if using password authentication, or the passphrase to use
# for unlocking keys that require it. (To disable attempting key authentication
# altogether, set options *allow_agent* and *look_for_keys* to `False`. (string
# value)
#
# This option has a sample default set, which means that
# its actual default value may vary from the one documented
# below.
#password = secret

# Private key filename (string value)
#key_filename = ~/.ssh/id_rsa

# Enables hostkey verification from ~/.ssh/known_hosts (boolean value)
#hostkey_verify = true

# ncclient device handler parameters, see ncclient documentation for supported
# device handlers. (dict value)
#device_params = name:default

# Enables querying SSH agent (if found) for keys. (boolean value)
#allow_agent = true

# Enables looking in the usual locations for ssh keys (e.g.
# :file:`~/.ssh/id_*`) (boolean value)
#look_for_keys = true

# The L2, L3, or L2+L3 forwarding instance to use when defining VLANs on the
# device. (string value)
# Advanced Option: intended for advanced users and not used
# by the majority of users, and might have a significant
# effect on stability and/or performance.
#network_instance = default


[networking_baremetal]

#
# From netconf-openconfig-driver-opts
#

# Enabled devices for which the plugin should manageconfiguration. Driver
# specific configuration for each device must be added in separate sections.
# (list value)
#
# This option has a sample default set, which means that
# its actual default value may vary from the one documented
# below.
#enabled_devices = common-example,netconf-openconfig-example