2.3. OI 网络生成配置

预计完成时间:30 分钟

可操作组件的所有者:INV/PNET

提供了一个二进制文件,用于自动生成 Operations Suite 基础设施 (OI) 交换机和防火墙所需的配置文件。此文件必须可从 GDC tar 文件或为部署提供的特定 OI 制品(例如 IT_component_bundle.tar.gz)中获取。

二进制文件是 occonfigtool。它使用 YAML 文件获取输入。规范概述如下。

如需了解如何将二进制文件导入您的环境,请参阅下载文件将 GDC 下载内容转移到网闸隔离配置环境

2.3.1. YAML 规范

属性
说明

domain
字符串
运营中心的网域后缀。 示例:
- opscenter.local
features
FeatureOptions
在配置 OI 部署时可以启用的功能。功能选项在功能选项中进行了介绍。 示例:
- multisite, no-firewall, etc.
segments
SegmentInfo
用于配置 OI 的细分信息。

2.3.1.1. 功能选项

“功能”标签页提供了可在 OI 部署中启用的所有功能。支持以下功能:

功能
说明
使用情况
banner
字符串
添加到所有 OCCORE 交换机和防火墙以及运维套件设施 (OIF) 交换机的登录横幅。
banner: |
This is a banner example.
Multi-line banner input is also supported.
multisite
bool
生成 2 个完整的 OC IT 配置以及所有站点间配置
multisite: true
virtual
bool
为虚拟 OI 生成配置
virtual: true
no-firewall
bool
启用不需要 OCCORE 防火墙的部署选项。
在此部署方法中,前端 VRF (GDCH-DATA-TRANSIT/ GDCH-MGMT-TRANSIT) 不存在,所有互连会话都由 OC-DATA VRF 和 HW-INFRA VRF 直接处理。
no-firewall: true
deny-all-acls
bool
生成所有 ACL 配置,并明确将最后一条规则设为“全部拒绝”。
deny-all-acls: true
L3-WAN
bool
生成用于与 L3-WAN 对等的 OCIT 配置。这包括前门 VRF、防火墙环回链接和路由政策。
deny-all-acls: true
crypto-services
bool
生成配置以支持隔离的 VLAN 和子网,以便与加密相关设备及其管理一起使用。这不会在开关本身上启用任何加密功能。
crypto-services: true

2.3.1.2. 细分受众群信息

分段信息提供构建所有配置所需的输入。 以下属性作为每个细分的输入提供:

属性
说明
使用情况
segmentType
字符串
segmentType 参数是必需的,并且是 coreoc 段。
网站必须包含两个部分,每种类型各一个:coreoc
核心 表示所提供的信息将用于为单个 OCCORE 网站生成配置。
关联的其他参数列在 CoreInfo 中。
oc 表示所提供的信息将用于为单个 OC 网站生成配置。
关联的其他参数列在 OcInfo 中。
segments:
- segmentType: core



segments:
- segmentType: oc
InstanceID
int
表示网站。每个网站都必须具有唯一的实例 ID
对于非多网站 OI 部署,如果未提供实例 ID,则其值默认为“1”。
segments:
- segmentType: core
instanceID: 1
- segmentType: oc
instanceID: 1

2.3.1.3. 核心信息

核心信息提供了构建以下配置所需的所有输入:

  • occoresw01
  • occoresw02
  • occorefw01
  • occorefw02
属性
说明

bgp
map
要用于 coregdch-transit BGP 自治系统 (AS) 的自治系统编号 (ASN)。

ASN
core
uint32
OIR 网络的 ASN。用于主 BGP 进程。这对于 OIR 具有本地重要性。
gdch-transit
uint32
用于放置所有 GDC BGP 会话的 OIR 传输网络(`GDCH-DATA-TRANSIT` 和 `GDCH-MGMT-TRANSIT` VRF)的 ASN。此 ASN 用于将 OIR 与 GDC 对等互连
示例:
bgp:
asn:
core: 65001
gdch-transit: 65101
uplinkSpeed
uint32
(可选)提供连接的上行速度(10100)。 值:10100
默认值:10

示例:
uplinkSpeed: 100
remoteUplinkSpeed
uint32
(可选)提供所有远程连接(10100)的上行链路速度。 值:10100
默认值:10

示例:
remoteUplinkSpeed: 100
cidrs
[]CIDR
用于 OIR 网络的 CIDR 列表。 值:/20 网络地址

示例:
cidrs:
- 172.21.0.0/20
cablesCSV
字符串
电缆的 CSV 文件路径。
此文件提供 OCCORE 机架中的 OI 连接信息。
每段类型为 core 的线缆都有自己的唯一电缆文件。
示例:
cablesCSV: /path/to/cables1.csv
devicesCSV
字符串
devices.csv 文件的路径
此文件提供 OCCORE 机架中设备的信息
每段类型为 core 的内容都有自己的唯一设备文件。
示例:
devicesCSV: /path/to/devices1.csv

2.3.1.4. OC 信息

核心信息提供了构建运维套件设施 (OIF) 交换机 (OCSW) 配置所需的所有输入:

属性
说明

bgp
map
要用于 oc BGP 自治系统 (AS) 的自治系统编号 (ASN)。

ASN
oc
uint32
OC 网络的 ASN。
示例:
bgp:
asn:
oc: 65301
uplinkSpeed
uint32
(可选)提供连接的上行速度(10100)。 值:10100
默认值:10

示例:
uplinkSpeed: 100
remoteUplinkSpeed
uint32
(可选)提供所有远程连接(10100)的上行链路速度。 值:10100
默认值:10

示例:
remoteUplinkSpeed: 100
onlyRemoteOC
bool
可选:将本地 OC 实例视为远程 OC 实例。这意味着,具有相同实例 ID 的 OC-CORE 交换机使用远程上行链路连接到 OC 交换机。这也适用于 OC 交换机,这意味着 OC 交换机使用远程上行链路连接到 OC-CORE 交换机。 值:truefalse
默认值:false

示例:
onlyRemoteOC: true
cidrs
[ ] CIDR
用于 OIR 网络的 CIDR 列表。 值:/20 网络地址

示例:
cidrs:
- 172.21.32.0/20
workstationsPerSwitch
uint32
要为 OIR 网络配置的工作站数量。此命令可设置从 Eth1/1 接口开始的接口数量。每个细分允许的最大值为 40。如果未指定此字段,则为工作站配置接口 1-10。 值:1-40

示例:
workstationsPerSwitch: 15

2.3.2. CLI 选项

选项
说明

-o
--ocit-file
用于生成 OI 配置的输入 YAML 文件 示例:
- occonfigtool generate ocit config -o example_ocit.yaml
-c
--conn-file
用于生成互连配置的输入互连文件。如需了解详情,请参阅:附录 A 示例:
- occonfigtool generate ocit config -o example_ocit.yaml -c interconnect.yaml
-d
--debug
此标志选项用于生成调试日志。显示内部数据结构,但不生成任何输出文件 示例:
- occonfigtool generate ocit config -o example_ocit.yaml -d
-f
--output-folder
生成所有配置文件,并将它们放置在指定名称的文件夹中 示例:
- occonfigtool generate ocit config -o example_ocit.yaml -f configs
-s
--simplify-configs
通过将 ACL 配置与其他配置放在同一文件中,简化了交换机配置 示例:
- occonfigtool generate ocit config -o example_ocit.yaml -s occonfigtool generate ocit config -o example_ocit.yaml -c interconnect.yaml -s

2.3.3. 生成输入文件示例

如需获取基准输入 YAML 文件,请运行以下命令:

occonfigtool generate ocit example -o ocit.yaml

示例输出如下:

domain: opscenter.local
segments:
  -   segmentType: core
    instanceID: 1
    cablesCSV: /path/to/cables.csv
    bgp:
      asn:
        core: 65535
        gdch-transit: 65515
    uplinkSpeed: 10
    cidrs:
      -   172.21.0.0/20
  -   segmentType: oc
    instanceID: 1
    cablesCSV: /path/to/cables.csv
    bgp:
      asn:
        oc: 65525
    uplinkSpeed: 10
    cidrs:
      -   172.21.32.0/20

2.3.4. 根据需要更新输入文件

之后,修改 ocit.yaml 文件以反映所有必要的更改。如有需要,请参阅 YAML 规范

需要确认的主要事项是 BGP ASN 和网络 CIDR 块。

2.3.5. 生成基本配置

使用更新后的 ocit.yaml 文件,运行 occonfigtool 以生成配置。运行以下命令:

生成的配置文件具有以下格式的前缀:

<segment_type><device_type><instance_id><device_id>

occonfigtool generate ocit config -o ./ocit.yaml

输出示例:

Configuration written to coresw101.base.opscenter.local.cfg
Configuration written to coresw102.base.opscenter.local.cfg
Configuration written to corefw101.base.opscenter.local.cfg
Configuration written to corefw102.base.opscenter.local.cfg
Configuration written to coresw101.acl.opscenter.local.cfg
Configuration written to coresw102.acl.opscenter.local.cfg
Configuration written to ocsw101.base.opscenter.local.cfg
Configuration written to ocsw102.base.opscenter.local.cfg
Configuration written to ocsw101.acl.opscenter.local.cfg
Configuration written to ocsw102.acl.opscenter.local.cfg
Configuration written to ocit-topology-exchange-1.common.opscenter.local.yaml
Configuration written to ocinfo.common.opscenter.local.txt
SHA1 sums written to configs.shasum.ocit.txt (use "shasum -c configs.shasum.ocit.txt" on receiving side to verify integrity)

2.3.5.1. 为多站点部署生成基本配置

确保您的 ocit.yaml 文件中有两个实例,如示例文件所示。multisite 功能标志必须设置为 true

domain: opscenter.local
features:
  multisite: true
segments:
  -   segmentType: core
    instanceID: 1
    cablesCSV: /path/to/cables1.csv
    devicesCSV: /path/to/devices1.csv
    bgp:
      asn:
        core: 65072
        gdch-transit: 65515
    uplinkSpeed: 10
    cidrs:
      -   10.1.0.0/20
  -   segmentType: oc
    instanceID: 1
    bgp:
      asn:
        oc: 65072
    uplinkSpeed: 10
    cidrs:
      -   10.1.32.0/20
  -   segmentType: core
    instanceID: 2
    cablesCSV: /path/to/cables2.csv
    devicesCSV: /path/to/devices2.csv
    bgp:
      asn:
        core: 65073
        gdch-transit: 65525
    uplinkSpeed: 10
    cidrs:
      -   10.2.0.0/20
  -   segmentType: oc
    instanceID: 2
    bgp:
      asn:
        oc: 65073
    uplinkSpeed: 10
    cidrs:
      -   10.2.32.0/20

输出示例:

Configuration written to coresw101.base.opscenter.local.cfg
Configuration written to coresw102.base.opscenter.local.cfg
Configuration written to corefw101.base.opscenter.local.cfg
Configuration written to corefw102.base.opscenter.local.cfg
Configuration written to coresw101.acl.opscenter.local.cfg
Configuration written to coresw102.acl.opscenter.local.cfg
Configuration written to ocsw101.base.opscenter.local.cfg
Configuration written to ocsw102.base.opscenter.local.cfg
Configuration written to ocsw101.acl.opscenter.local.cfg
Configuration written to ocsw102.acl.opscenter.local.cfg
Configuration written to coresw201.base.opscenter.local.cfg
Configuration written to coresw202.base.opscenter.local.cfg
Configuration written to corefw201.base.opscenter.local.cfg
Configuration written to corefw202.base.opscenter.local.cfg
Configuration written to coresw201.acl.opscenter.local.cfg
Configuration written to coresw202.acl.opscenter.local.cfg
Configuration written to ocsw201.base.opscenter.local.cfg
Configuration written to ocsw202.base.opscenter.local.cfg
Configuration written to ocsw201.acl.opscenter.local.cfg
Configuration written to ocsw202.acl.opscenter.local.cfg
Configuration written to ocit-topology-exchange-1.common.opscenter.local.yaml
Configuration written to ocit-topology-exchange-2.common.opscenter.local.yaml
Configuration written to ocinfo.common.opscenter.local.txt
SHA1 sums written to configs.shasum.ocit.txt (use "shasum -c configs.shasum.ocit.txt" on receiving side to verify integrity)

系统必须将配置文件保存到当前工作目录。如果在生成配置时启用了 output-folder CLI 选项,则输出文件将生成并保存在该文件夹路径中。

用于生成配置文件的命令如下:

occonfigtool generate ocit config -o ocit.yaml -f path/to/configs

输出示例:

Configuration written to ./path/to/configs/site-1/base/coresw101.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-1/base/coresw102.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-1/base/corefw101.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-1/base/corefw102.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-1/base/acl/coresw101.acl.opscenter.local.cfg
Configuration written to ./path/to/configs/site-1/base/acl/coresw102.acl.opscenter.local.cfg
Configuration written to ./path/to/configs/site-1/base/ocsw101.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-1/base/ocsw102.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-1/base/acl/ocsw101.acl.opscenter.local.cfg
Configuration written to ./path/to/configs/site-1/base/acl/ocsw102.acl.opscenter.local.cfg
Configuration written to ./path/to/configs/site-2/base/coresw201.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-2/base/coresw202.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-2/base/corefw201.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-2/base/corefw202.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-2/base/acl/coresw201.acl.opscenter.local.cfg
Configuration written to ./path/to/configs/site-2/base/acl/coresw202.acl.opscenter.local.cfg
Configuration written to ./path/to/configs/site-2/base/ocsw201.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-2/base/ocsw202.base.opscenter.local.cfg
Configuration written to ./path/to/configs/site-2/base/acl/ocsw201.acl.opscenter.local.cfg
Configuration written to ./path/to/configs/site-2/base/acl/ocsw202.acl.opscenter.local.cfg
Configuration written to ./path/to/configs/site-1/ocit-topology-exchange-1.common.opscenter.local.yaml
Configuration written to ./path/to/configs/site-2/ocit-topology-exchange-2.common.opscenter.local.yaml
Configuration written to ./path/to/configs/ocinfo.common.opscenter.local.txt
SHA1 sums written to path/to/configs/configs.shasum.ocit.txt (use "shasum -c path/to/configs/configs.shasum.ocit.txt" on receiving side to verify integrity)

如需了解详细步骤,请参阅下一部分。

2.3.5.2. 为 L3-WAN 连接生成基本配置

配置并声明 L3-WAN 连接。以下示例展示了一个已完成的 YAML 文件,其中包含 L3-WAN 连接的正确配置:

domain: opscenter.local
features:
  L3-WAN: true
segments:
  -   segmentType: core
    instanceID: 1
    cablesCSV: /path/to/cables.csv
    devicesCSV: /path/to/devices.csv
    bgp:
      asn:
        core: 65535
        gdch-transit: 4200002002
        wan-transit: 65000
    uplinkSpeed: 10
    cidrs:
      -   172.21.0.0/20
  -   segmentType: oc
    instanceID: 1
    bgp:
      asn:
        oc: 65525
    uplinkSpeed: 10
    cidrs:
      -   172.21.32.0/20