• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

01-基础配置命令参考

目录

08-GIR命令

本章节下载 08-GIR命令  (296.03 KB)

08-GIR命令


1 GIR

1.1  GIR配置命令

1.1.1  config-end

config-end命令用来退出custom-profile视图。

【命令】

config-end

【视图】

custom-profile视图

【缺省用户角色】

network-admin

【使用指导】

用户能通过该命令结束配置并退出custom-profile视图,也可以通过quit命令退回上一层视图,但是在配置文件里会自动转换成config-end,表示配置文件的配置内容到此结束。

【举例】

# 退出custom-profile视图。

<Sysname> system-view

[Sysname] gir custom-profile maintenance-mode

Enter commands, one command per line. To end the configuration and quit GIR profile view, execute the 'config-end' or 'quit' command.

[Sysname-gir-mm-profile] config-end

【相关命令】

·     display gir custom-profile

·     gir custom-profile

1.1.2  display gir custom-profile

display gir custom-profile命令用来显示custom-profile的内容

【命令】

display gir custom-profile [ maintenance-mode | normal-mode ]

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【参数】

maintenance-mode:显示正切profile的内容

normal-mode:显示回切profile的内容

【使用指导】

custom-profile是配置文件,分为正切profile和回切profile两类。如果没有指定任何参数,则同时显示正切profile和回切profile的内容。正切是指从普通模式切换到维护模式,回切是指从维护模式切换到普通模式。

【举例】

# 显示custom-profile的内容

<Sysname> display gir custom-profile

[Normal Mode]

undo link-aggregation lacp isolate

sleep instance 1 interval 30

bgp 100

  undo isolate enable

 

[Maintenance Mode]

bgp 100

  isolate enable

sleep instance 1 interval 30

link-aggregation lacp isolate

【相关命令】

·     gir custom-profile

1.1.3  display gir snapshot

display gir snapshot命令用来显示GIR快照信息。

【命令】

display gir snapshot

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【举例】

# 显示GIR快照信息。

<Sysname> display gir snapshot

Name                  Time                         Description

before_maintenance    Mon Aug 24 10:10:10 2020     Snapshot taken before maintenance

after_maintenance     Mon Aug 24 11:10:10 2020     Snapshot taken after maintenance

表1-1 display gir snapshot命令显示信息描述表

字段

描述

Name

GIR快照名

Time        

GIR快照生成的时间

Description

GIR快照的描述信息

 

【相关命令】

·     display gir snapshot compare

·     gir snapshot create

·     gir snapshot delete

·     gir system-mode maintenance

1.1.4  display gir snapshot compare

display gir snapshot compare命令用来显示GIR快照比较信息。

【命令】

display gir snapshot compare snapshot1-name snapshot2-name [ verbose ]

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【参数】

snapshot1-name:表示参与比较的第一个GIR快照的名称。

snapshot2-name:表示参与比较的第二个GIR快照的名称。

verbose:显示GIR快照的详细比较信息,且只显示有差异的信息。如果未指定本参数,则显示GIR快照的概要比较信息。

【使用指导】

当参与比较的快照较大时,会耗时较长。

快照存放的为当前配置对应的NETCON文件,如果想要了解显示信息中Feature和Tag字段的详细含义,请参见《NETCONF XML API手册》。

【举例】

# 显示GIR快照的详细比较信息。

<Sysname> display gir snapshot compare before_maintenance after_maintenance verbose

Feature   Tag                       before_maintenance       after_maintenance

[ifmgr/Interfaces]

[IfIndex:258]

          AdminStatus               1                        2

          OperStatus                1                        3

[Route/Ipv4Routes]

          [VRF:N/A Topology:N/A ProtocolID: 1]

          TotalRoutes               3                        4

以上信息表示设备切换到切换到维护模式后:

·     接口258的管理状态从1变成了2,操作状态从1变成了3。

·     IPv4路由表的数目从3条变成了4条。

表1-2 display gir snapshot compare命令显示信息描述表

字段

描述

Feature

特性名称

Tag

参与比较的Tag

before_maintenance

对应字段在before_maintenance中的取值

after_maintenance

对应字段在after_maintenance中的取值

 

# 显示GIR快照的简要比较信息。

<Sysname> display gir snapshot compare before_maintenance after_maintenance

Feature                          before_maintenance               after_maintenance          changed

basic

    # Interfaces           39                            39                       N

    # ipv4 routes          7                             7                        N

    # ipv6 routes          N/A                           7                        N/A

ifmgr

    # interfaces up        1                             0                        Y

    # interfaces down      38                            39                       Y

    # vlan interfaces      2                             2                        N

    # vlan interfaces up   0                             0                        N

    # vlan interfaces down 2                             2                        N

表1-3 display gir snapshot compare命令显示信息描述表

字段

描述

Feature

特性名称

before_maintenance

对应特性在before_maintenance中的配置信息条数

after_maintenance

对应特性在after_maintenance中的配置信息条数

Changed

对应特性的配置信息差异标记,取值包括:

·     Y:表示配置信息有差异

·     N:表示配置信息没有差异

·     N/A:表示快照数据过大,无法计算和比较

 

【相关命令】

·     display gir snapshot

1.1.5  display gir system-mode

display gir system-mode命令用来显示当前GIR模式。

【命令】

display gir system-mode

【视图】

任意视图

【缺省用户角色】

network-admin

network-operator

【举例】

# (以isolate方式进入维护模式后)显示当前GIR模式。

<Sysname> display gir system-mode

System mode:Maintenance

Revert-delay time: 5min

Maintenance-delay time: 120s

Snapshot-delay time: 120s

表1-4 display gir system-mode命令显示信息描述表

字段

描述

System mode

GIR系统模式,取值为:

·     maintenance:表示使用isolate方式进入的维护模式

·     maintenance(shutdown):表示使用shutdown方式进入的维护模式

·     maintenance(custom-profile):表示使用自定义profile方式进入的维护模式

·     normal:表示普通模式

·     normal(custom-profile):表示使用自定义profile方式回切的普通模式

Revert-delay time

表示从维护模式自动延时回切到普通模式的时长,单位为分钟。取值为0时表示设备未开启自动延时回切功能。

Maintenance-delay time

表示延时放开命令行的延时时长,单位为秒

Snapshot-delay time

表示切回普通模式后延时生成快照的时长,单位为秒

 

【相关命令】

·     gir system-mode maintenance

1.1.6  gir custom-profile

gir custom-profile命令用来进入custom-profile视图。

undo gir custom-profile命令用来删除custom-profile。

【命令】

gir custom-profile { maintenance-mode | normal-mode }

undo gir custom-profile { maintenance-mode | normal-mode }

【视图】

系统视图

【缺省用户角色】

network-admin

【参数】

maintenance-mode:表示进入custom-profile视图编辑正切profile或删除正切profile。

normal-mode:表示进入custom-profile视图编辑回切profile或删除回切profile。

【使用指导】

custom-profile是按顺序记录模式切换时系统下发命令的配置文件,包含正切profile和回切profile。当用户使用custom-profile方式切换到维护模式时系统会按顺序执行正切profile中配置的命令;当用户使用custom-profile方式切回到普通模式时系统会按顺序执行回切profile中配置的命令。正切profile和回切profile分别只能有一份,用户需进入custom-profile视图来配置正切profile和回切profile,配置规则如下:

·     系统使用custom-profile方式进行模式切换时会按顺序执行custom-profile中的命令,如果命令之间存在依赖关系请先输入前提命令。当在custom-profile中同时配置了一条命令与这条命令对应的undo命令,且undo命令undo后面的内容与这条命令完全一致,系统会自动在custom-profile中删除这两条命令。另外系统会自动删除custom-profile中重复的命令。

·     设备缺省在系统视图下执行custom-profile中的命令行,如果某条命令需要在系统视图的子视图下执行,则要求先输入进入子视图的命令,再输入该命令。custom-profile不支持下发用户视图下的命令。

·     相同视图的命令会合并到该视图下,并按添加的顺序下发。

·     在custom-profile中配置业务模块的命令,如果有命令存在延迟生效的情况,可以在此命令后通过sleep instance命令配置延时时长,这样在执行完该命令后系统会在配置的延时时长后再继续执行下一条命令,这样可以避免出现上一条命令还未生效便开始执行下一跳命令的情况。如果用户不能明确配置的命令是否需要延时,可以预先配置sleep instance命令并将等待时间设置为0,后续根据需求进行修改。

·     除了修改sleep instance的等待时间外,不支持对已配置的命令进行插入、修改或删除操作。可通过display gir custom-profile命令查看custom-profile的内容,如果发现配置错误,请先删除custom-profile,再重新配置。

·     custom-profile允许为空,当用户使用isolate或shutdown方式切换模式且模式对应的custom-profile为空的时,系统会将切换模式时执行的命令记录在对应的custom-profile中。用户编辑空的custom-profile前可以先使用isolate或shutdown方式进行模式切换,再基于记录了相应命令的custom-profile进行编辑。

·     custom-profile中不支持配置密钥类的命令行。

·     custom-profile下发命令的配置文件的存储空间有限,当新配置的命令行超过存储空间时,则此命令将配置失败,且无法再配置其他命令。建议不要将无关命令配置到custom-profile中。

【举例】

# 配置正切profile,设备使用custom-profile方式进入维护模式时,会配置LACP的系统MAC地址为0001-0001-0001。

<Sysname> system-view

[Sysname] gir custom-profile maintenance-mode

Enter commands, one command per line. To end the configuration and quit GIR profile view, execute the 'config-end' or 'quit' command.

[Sysname-gir-mm-profile] lacp system-mac 1-1-1

[Sysname-gir-mm-profile] config-end

# 配置回切profile,设备使用custom-profile方式切回到普通模式时,会将LACP的系统MAC地址恢复为缺省情况。

<Sysname> system-view

[Sysname] gir custom-profile normal-mode

Enter commands, one command per line. To end the configuration and quit GIR profile view, execute the 'config-end' or 'quit' command.

[Sysname-gir-nm-profile] undo lacp system-mac

[Sysname-gir-nm-profile] config-end

【相关命令】

·     config-end

·     display gir custom-profile

·     sleep instance

1.1.7  gir snapshot add

gir snapshot add命令用来配置创建GIR快照时获取模块数据。

undo gir snapshot add命令用来恢复缺省配置。

【命令】

gir snapshot add { ipv4routes | ipv6routes }*

undo gir snapshot add [ ipv4routes | ipv6routes ]*

【缺省情况】

创建GIR快照时不获取模块数据。

【视图】

系统视图

【缺省用户角色】

network-admin

【参数】

ipv4routes:IPv4路由信息。

ipv6routes:IPv6路由信息

【使用指导】

由于部分业务模块数据量(如路由信息)较大,快照创建时设备缺省不获取模块数据。执行本命令可以使设备在创建快照时获取模块数据,快照中将包含该模块的信息。

【举例】

# 创建快照时添加IPv4路由信息。

<Sysname> system-view

[Sysname] gir snapshot add ipv4routes

# 创建快照时添加IPv6路由信息。

<Sysname> system-view

[Sysname] gir snapshot add ipv6routes

【相关命令】

·     gir snapshot create

·     gir system-mode maintenance

1.1.8  gir snapshot create

gir snapshot create命令用来创建GIR快照。

【命令】

gir snapshot create snapshot-name description

【视图】

系统视图

【缺省用户角色】

network-admin

【参数】

snapshot-name:表示GIR快照名称,为1~64个字符的字符串,可以包含数字、字母和下划线。GIR快照名称不允许使用before_maintenance、after_maintenance以及all。快照名称是否区分大小写请以设备的实际情况为准。

description:GIR快照的描述信息,为1~255个字符的字符串,区分大小写。

【使用指导】

设备进入维护模式前自动生成快照before_maintenance,退出维护模式后自动生成快照after_maintenance。系统正常运行时用户可以在任何时间手动创建快照,并通过对比两份快照数据,获知系统运行数据的变化。

除before_maintenance和after_maintenance外,最多允许创建10个快照。

设备在生成快照时,请不要执行模式切换、显示快照或删除快照操作。

【举例】

# 创建GIR快照:名字snapA,描述信息:Aaaa。

<Sysname> system-view

[System] gir snapshot create snapA Aaaa

Collecting snapshot data...Please wait.

Generated a snapshot: snapA.

【相关命令】

·     display gir snapshot

1.1.9  gir snapshot delete

gir snapshot delete命令用来删除快照。

【命令】

gir snapshot delete { all | snapshot-name }

【视图】

系统视图

【缺省用户角色】

network-admin

【参数】

all:表示删除所有快照。

snapshot-name:表示GIR快照名称,为1~64个字符的字符串,可以包含数字、字母和下划线。GIR快照名称不允许使用before_maintenance、after_maintenance以及all。快照名称是否区分大小写请以设备的实际情况为准。

【举例】

# 删除所有的GIR快照。

<Sysname> system-view

[Sysname] gir snapshot delete all

# 删除名称为snapA的GIR快照。

<Sysname> system-view

[Sysname] gir snapshot delete snapA

【相关命令】

·     display gir snapshot

1.1.10  gir system-mode maintenance

gir system-mode maintenance命令用来将设备从普通模式切换到维护模式。

undo gir system-mode maintenance命令用来将设备从维护模式切回普通模式。

【命令】

gir system-mode maintenance [ shutdown | custom-profile ] [ non-interactive ]

undo gir system-mode maintenance [ custom-profile ] [ non-interactive ]

【视图】

系统视图

【缺省用户角色】

network-admin

【参数】

shutdown:表示以shutdown方式进入维护模式。

custom-profile:表示以custom-profile方式来进行模式切换。

non-interactive:表示在后台完成模式切换。模式切换过程中,无交互信息,没有提示和确认信息,请谨慎配置。不指定该参数时,以交互形式执行该命令。

【使用指导】

注意

·     执行本命令后,可能会发生流量丢包导致相关业务中断,请谨慎使用。

·     在模式切换过程中,请不要重启设备或进程,设备重启或部分进程重启可能会中止模式切换,而且已下发的业务模块命令无法回滚。

 

通过执行本命令,会下发相关的协议隔离命令给对应的业务模块,由对应业务模块自动执行隔离命令,实现设备的流量隔离。各业务模块实现隔离的方式有isolate和shutdown两种,具体的隔离实现请参考各业务模块的手册。

执行本命令前,请注意查看设备是否处于稳定状态,避免命令下发失败。用户可以执行display system stable state命令查看设备状态,有关display system stable state命令的详细介绍,请参见“基础配置命令参考”中的“设备管理”。

·     正切是指从普通模式切换到维护模式,正切有三种方式:

¡     设备通过isolate方式进入维护模式,设备缺省使用此方式。以此方式正切的设备会通过isolate功能对BGP、IS-IS、OSPF、OSPFv3、LACP和VRRP协议进行隔离。

¡     设备通过shutdown方式进入维护模式。以此方式正切的设备会通过shutdown功能对BGP、IS-IS、OSPF和OSPFv3协议进行隔离,并且关闭设备上除管理口外的所有接口。

¡     设备通过用custom-profile方式进入维护模式。用户可进入custom-profile视图自定义配置设备正切时隔离的协议和关闭的接口等。

如果没有指定shutdowncustom-profile参数,则设备以isolate方式进入维护模式。关于正切方式的原理介绍及三种切换方式的区别,请参见“基础配置指导”中的“GIR”。

·     回切是指从维护模式切换到普通模式,回切有两种方式:

¡     设备通过与正切对应的方式回切,如果设备正切时是通过isolate或custom-profile方式,则采用isolate正切对应的反向操作回切;如果设备正切时是通过shutdown方式,则采用shutdown正切对应的反向操作回切。

¡     设备通过custom-profile方式回切,这时设备会采用用户在回切profile中配置的命令回切。

切换到维护模式后,请不要修改各业务模块的配置,否则会导致退出维护模式后,设备配置与原来配置不一致。为了方便用户确认设备进入维护模式前和退出维护模式后是否存在配置差异,可以通过设备提供的GIR快照功能进行查看。

如果在切换模式的过程中,有业务模块命令下发失败,请注意:

·     设备会不再继续进行模式切换并回到原有模式,但已下发命令不回滚。

·     设备会提示失败信息,用户可根据业务模块的具体提示信息排查失败原因。

如果设备正在进行快照显示与比较,请等待快照显示与比较命令结束后再执行模式切换命令。

【举例】

# 通过isolate方式正切。

<Sysname> system-view

[Sysname] gir system-mode maintenance

Collecting commands... Please wait.

Configuration to be applied:

   bgp 1

     isolate enable

   isis 2

     isolate enable

   sleep instance 1 interval 30

   link-aggregation lacp isolate

Do you want to continue? [Y/N]: y

Generated a snapshot: before_maintenance.

Applying: bgp 1

Applying: isolate enable

Applying: isis 2

Applying: isolate enable

Applying: sleep instance 1 interval 30

Applying: link-aggregation lacp isolate

Waiting 120 seconds to release the CLI.

Changed to maintenance mode successfully.

# 通过isolate方式正切且在后台完成模式切换。

<Sysname> system-view

[Sysname] gir system-mode maintenance non-interactive

Mode switching will be performed in the background.

# 通过shutdown方式正切。

<Sysname> system-view

[Sysname] gir system-mode maintenance shutdown

Collecting commands... Please wait.

Configuration to be applied:

   isis 2

     shutdown process

   sleep instance 1 interval 60

   shutdown all-physical-interfaces

The operation will shut down all physical interfaces except the management ports.

Do you want to continue? [Y/N]: y

Generated a snapshot: before_maintenance.

Applying: isis 2

Applying: shutdown process

Applying: sleep instance 1 interval 60

Applying: shutdown all-physical-interfaces

Waiting 120 seconds to release the CLI.

Changed to maintenance mode successfully.

# 通过与正切对应的方式回切。

<Sysname> system-view

[Sysname] undo gir system-mode maintenance

Collecting commands... Please wait.

Configuration to be applied:

   undo link-aggregation lacp isolate

   sleep instance 1 interval 30

   isis 2

     undo isolate enable

   bgp 1

     undo isolate enable

Do you want to continue? [Y/N]: y

Applying: undo link-aggregation lacp isolate

Applying: sleep instance 1 interval 30

Applying: isis 2

Applying: undo isolate enable

Applying: bgp 1

Applying: undo isolate enable

Waiting 120 seconds to generate a snapshot.

Generated a snapshot: after_maintenance.

Changed to normal mode successfully.

# 以custom-profile方式正切。

<Sysname> system-view

[Sysname] gir system-mode maintenance custom-profile

Collecting commands... Please wait.

Configuration to be applied:

   bgp 1

     isolate enable   

   isis 2

     isolate enable

   sleep instance 1 interval 60

   link-aggregation lacp isolate

Do you want to continue? [Y/N]: y

Generated a snapshot: before_maintenance.

Applying: bgp 1

Applying: isolate enable

Applying: isis 2

Applying: isolate enable

Applying: sleep instance 1 interval 60

Applying: link-aggregation lacp isolate

Waiting 120 seconds to release the CLI.

Changed to maintenance mode successfully.

# 通过custom-profile方式回切。

<Sysname> system-view

[Sysname] undo gir system-mode maintenance custom-profile

Collecting commands... Please wait.

Configuration to be applied:

   undo link-aggregation lacp isolate

   sleep instance 1 interval 60

   bgp 1

     undo isolate enable

Do you want to continue? [Y/N]: y

Applying: undo link-aggregation lacp isolate

Applying: sleep instance 1 interval 60

Applying: bgp 1

Applying: undo isolate enable

Waiting 120 seconds to generate a snapshot.

Generated a snapshot: after_maintenance.

Changed to normal mode successfully.

【相关命令】

·     display gir custom-profile

·     display gir snapshot

·     display gir snapshot compare

1.1.11  gir system-mode maintenance maintenance-delay

gir system-mode maintenance maintenance-delay命令用来配置设备切换到维护模式后放开命令行的延时时长。

undo gir system-mode maintenance maintenance-delay命令用来恢复缺省情况。

【命令】

gir system-mode maintenance maintenance-delay value

undo gir system-mode maintenance maintenance-delay

【缺省情况】

延时放开命令行的时长为120秒。

【视图】

系统视图

【缺省用户角色】

network-admin

【参数】

value:取值范围为0~65535,单位为秒。

【使用指导】

如果设备切换到维护模式的过程中,需要业务模块执行一些生效较慢的命令行,则可能会导致设备已经进入维护模式但这些业务模块的命令仍没有生效。此时如果执行命令行,可能会影响业务模块命令行的实际效果。

为了避免这种情况,可使用本命令配置设备切换到维护模式后,需要等待指定的时间,才能执行命令行

【举例】

# 配置延时放开命令行的延时时长为10s。

<Sysname> system-view

[Sysname] gir system-mode maintenance maintenance-delay 10

【相关命令】

·     gir system-mode maintenance

1.1.12  gir system-mode maintenance revert-delay

gir system-mode maintenance revert-delay命令用来配置从维护模式延时切回普通模式的时长。

undo gir system-mode maintenance revert-delay命令用来恢复缺省情况。

【命令】

gir system-mode maintenance revert-delay value

undo gir system-mode maintenance revert-delay

【缺省情况】

设备切到维护模式后,不会自动回切到普通模式。

【视图】

系统视图

【缺省用户角色】

network-admin

【参数】

value:延时时长,取值范围为5~65535,单位为分钟。

【使用指导】

配置本命令且将设备切换到维护模式,则设备在指定时间后,会自动回切到普通模式。用户可在维护模式期间需要执行的任务时长较为确认的情况下执行本命令。

【举例】

# 设定自动回切的延时时长为10分钟。

<Sysname> system-view

[Sysname] gir system-mode maintenance revert-delay 10

【相关命令】

·     gir system-mode maintenance

1.1.13  gir system-mode maintenance snapshot-delay

gir system-mode maintenance snapshot-delay命令用来设置切回普通模式后延时生成快照的时长。

undo gir system-mode maintenance snapshot-delay命令用来恢复缺省配置。

【命令】

gir system-mode maintenance snapshot-delay value

undo gir system-mode maintenance snapshot-delay

【缺省情况】

延时生成快照的时长为120s。

【视图】

系统视图

【缺省用户角色】

network-admin

【参数】

value:表示切回普通模式后延时生成快照的延时时长,取值范围为0~65535,单位为秒。

【使用指导】

对于协议恢复较慢的业务模块,可以通过执行本命令配置延时生成after_maintenance的快照,获取更准确和完整的数据。

【举例】

# 设定延时生成after_maintenance的延时时长为10秒。

<Sysname> system-view

[System] gir system-mode maintenance snapshot-delay 10

【相关命令】

·     gir system-mode maintenance

1.1.14  sleep instance

sleep instance命令用来配置延时执行下一条命令。

【命令】

sleep instance instance-number interval seconds

【缺省情况】

不会延时,执行完当前命令,立即执行下一条命令。

【视图】

custom-profile视图

【缺省用户角色】

network-admin

【参数】

instance-number:表示实例编号,取值范围为0~2177483647。同一Profile中对同一实例重复执行本命令,可以修改实例对应的延时时间。

seconds:表示延时执行下一条命令的时长,取值范围为0~2177483647,单位为秒。

【使用指导】

当需要使用custom-profile方式切换设备运行模式,且custom-profile中要执行的命令存在延迟生效的情况时,可以在该命令后插入sleep instance命令,这样,设备在执行完该命令后会延时指定的时间再继续执行下一条命令,从而避免出现该命令还未生效便开始执行下一条命令的情况。

如果用户不能明确配置的命令是否需要延时以及延时的具体时长,可以预先配置sleep instance 0,后续再根据测试效果进行修改。

【举例】

# 配置实例1延时10秒后再执行下一条命令。

<Sysname> system-view

[Sysname] gir custom-profile maintenance-mode

Enter commands, one command per line. To end the configuration and quit GIR profile view, execute the 'config-end' or 'quit' command.

[Sysname-gir-mm-profile] sleep instance 1 interval 10

 【相关命令】

·     gir custom-profile

 

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们