annet 3.15.0__py3-none-any.whl → 3.16.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of annet might be problematic. Click here for more details.

@@ -0,0 +1,118 @@
1
+ from annet.annlib.lib import huawei_collapse_vlandb as collapse_vlandb
2
+ from annet.annlib.lib import huawei_expand_vlandb as expand_vlandb
3
+ from annet.annlib.types import Op
4
+
5
+ from annet.rulebook import common
6
+ from annet.rulebook.common import DiffItem
7
+
8
+
9
+ # =====
10
+ def single(rule, key, diff, **_):
11
+ yield from _process_vlandb(rule, key, diff, False, False, None)
12
+
13
+
14
+ def multi(rule, key, diff, **_):
15
+ yield from _process_vlandb(rule, key, diff, True, False, 10)
16
+
17
+
18
+ def multi_all(rule, key, diff, **_):
19
+ yield from _process_vlandb(rule, key, diff, True, True, 10)
20
+
21
+
22
+ def vlan_diff(old, new, diff_pre, _pops):
23
+ batch_new = set() # vlan batch ... vlan ids
24
+ for row in new:
25
+ prefix, vlans = _parse_vlancfg(row)
26
+ if prefix == "vlan batch":
27
+ batch_new.update(vlans)
28
+ ret = []
29
+ for item in common.default_diff(old, new, diff_pre, _pops):
30
+ prefix, vlan_ids = _parse_vlancfg(item.row)
31
+ # If a VLAN was declared globally and still remains in the batch,
32
+ # the command "undo vlan ..." will attempt to completely remove it from the device
33
+ # as well as from the batch. However, using "undo vlan ... ; vlan batch ..." is not a solution,
34
+ # since to delete it, the CLI requires removing all VLAN interfaces and related elements first.
35
+
36
+ if prefix == "vlan" and item.op == Op.REMOVED and batch_new.intersection(vlan_ids):
37
+ result_item = DiffItem(Op.AFFECTED, item.row, item.children, item.diff_pre)
38
+ # If a VLAN is declared both globally and in the batch,
39
+ # and the global declaration block has no additional options,
40
+ # we don’t include it — it would just hang there unnecessarily.
41
+ # This way, we preserve symmetry with the previous logic,
42
+ # and both invariants will produce an empty patch.
43
+
44
+ elif prefix == "vlan" and batch_new.intersection(vlan_ids) and not item.children:
45
+ result_item = None
46
+ # We don’t touch "vlan batch" or anything else.
47
+ else:
48
+ result_item = item
49
+ if result_item:
50
+ ret.append(result_item)
51
+ return ret
52
+
53
+
54
+ # =====
55
+ def _process_vlandb(rule, key, diff, multi, multi_all, multi_chunk): # pylint: disable=unused-argument,redefined-outer-name
56
+ assert len(diff[Op.AFFECTED]) == 0, "WTF? Affected signle: %r" % (diff[Op.AFFECTED])
57
+ if not multi:
58
+ for op in (Op.ADDED, Op.REMOVED):
59
+ assert 0 <= len(diff[op]) <= 1, "Too many actions: %r" % (diff)
60
+
61
+ if diff[Op.REMOVED] and not diff[Op.ADDED]: # Removed
62
+ if multi and multi_all:
63
+ yield (False, rule["reverse"].format(*key) + " all", None)
64
+ return
65
+ elif not multi and not multi_all:
66
+ yield (False, rule["reverse"].format(*key), None)
67
+ return
68
+
69
+ (prefix_add, new) = _parse_vlancfg_actions(diff[Op.ADDED])
70
+ (prefix_del, old) = _parse_vlancfg_actions(diff[Op.REMOVED])
71
+ removed = old.difference(new)
72
+ added = new.difference(old)
73
+
74
+ if removed:
75
+ collapsed = collapse_vlandb(removed)
76
+ for chunk in (_chunked(collapsed, multi_chunk) if multi else [collapsed]):
77
+ yield (False, "undo %s %s" % (prefix_del, " ".join(chunk)), None)
78
+
79
+ if added:
80
+ collapsed = collapse_vlandb(added)
81
+ for chunk in (_chunked(collapsed, multi_chunk) if multi else [collapsed]):
82
+ yield (True, "%s %s" % (prefix_add, " ".join(chunk)), None)
83
+
84
+
85
+ def _chunked(items, size):
86
+ for offset in range(0, len(items), size):
87
+ yield items[offset:offset + size]
88
+
89
+
90
+ def _parse_vlancfg_actions(actions):
91
+ prefix = None
92
+ vlandb = set()
93
+ for action in actions:
94
+ (prefix, part) = _parse_vlancfg(action["row"])
95
+ vlandb.update(part)
96
+ return (prefix, vlandb)
97
+
98
+
99
+ def _parse_vlancfg(row):
100
+ parts = row.split()
101
+ assert len(parts) > 0, row
102
+ index = None
103
+ for (index, item) in reversed(list(enumerate(parts))):
104
+ if not (item.isdigit() or item == "to"):
105
+ break
106
+ prefix = " ".join(parts[:index + 1])
107
+ vlandb = expand_vlandb(" ".join(parts[index + 1:]))
108
+ return (prefix, vlandb)
109
+
110
+
111
+ def _find_new_vlans(root_pre):
112
+ ret = set()
113
+ for (rule, pre) in root_pre.items():
114
+ if not rule.startswith("vlan batch"):
115
+ continue
116
+ new = _parse_vlancfg_actions(pre["items"][tuple()][Op.ADDED])[1]
117
+ ret.update(new)
118
+ return ret
@@ -0,0 +1,196 @@
1
+ # Рулбук деплоя на устройства
2
+ #
3
+ # Операторы:
4
+ # * Один аргумент
5
+ # ~ Несколько аргументов (минимум один)
6
+ #
7
+ # Параметры:
8
+ # %timeout=... Таймаут выполнения команды (в секундах, по умолчанию 30)
9
+ #
10
+ # Ответы на вопросы
11
+ #
12
+ # <команда>
13
+ # dialog: <вопрос> ::: <ответ> <параметры>
14
+ #
15
+ # Если <вопрос> заключён в слеши (//), то воспринимается как регулярка, иначе - точное совпадение.
16
+ # Параметы:
17
+ # %send_nl=... Посылать ли перевод строки после ответа (bool, по умолчанию true)
18
+ # -----
19
+
20
+ undo bgp
21
+ dialog: Warning: The BGP process will be deleted. Continue? [Y/N]: ::: Y
22
+ undo peer *
23
+ dialog: Warning: All the configurations related to the BGP peer will be deleted. Continue? [Y/N]: ::: Y
24
+ dialog: Warning: This operation will reset the peer session. Continue? [Y/N]: ::: Y
25
+ peer * enable
26
+ dialog: Warning: This operation will reset the peer session. Continue? [Y/N]: ::: Y
27
+ peer * timer
28
+ dialog: Warning: Changing the parameter in this command resets the peer session. Continue? [Y/N]: ::: Y
29
+ undo route-distinguisher *
30
+ dialog: Warning: RTs of VPN instance and IPv6 related configurations under BGP will be deleted. Continue? [Y/N]: ::: Y
31
+ dialog: Warning: All the VPN targets in the VPN instance IPv6 address family will be deleted. Continue? [Y/N]: ::: Y
32
+ dialog: Warning: All VPN targets of this EVPN instance and all EVPN address family-related configurations under BGP will be deleted. Continue? [Y/N]: ::: Y
33
+
34
+ save
35
+ dialog: /Warning: The current configuration will be written to the device. Continue\? \[Y/N\]:?/ ::: Y
36
+ dialog: Warning: The current configuration will be written to the device. Are you sure to continue? [Y/N]: ::: Y
37
+ dialog: Are you sure to continue?[Y/N] ::: Y
38
+ dialog: Are you sure to continue? [Y/N] ::: Y
39
+ dialog: Please input the file name(*.cfg, *.zip, *.dat): ::: vrpcfg.zip
40
+ undo rsa peer-public-key
41
+ dialog: /Do you want to remove the public key named .*\? \[Y/N\]:/ ::: Y
42
+ undo stelnet server enable
43
+ dialog: Warning: The operation will stop the STelnet server. Do you want to continue? [Y/N]: ::: Y
44
+ undo telnet * server enable
45
+ dialog: Warning: The operation will stop the .*Telnet server. Continue? [Y/N]: ::: Y
46
+ undo stelnet * server enable
47
+ dialog: Warning: The operation will stop the STelnet server. Do you want to continue? [Y/N]: ::: Y
48
+ telnet ipv6 server-source all-interface
49
+ dialog: Warning: Telnet server source configuration will take effect in the next login. Do you want to continue? [Y/N]: ::: Y
50
+ telnet server-source all-interface
51
+ dialog: Warning: Telnet server source configuration will take effect in the next login. Do you want to continue? [Y/N]: ::: Y
52
+ dialog: Warning: Telnet server source configuration will take effect in the next login. Continue? [Y/N]: ::: Y
53
+ telnet ipv6 server-source all-interface
54
+ dialog: Warning: The IPv6 Telnet server source configuration will take effect in the next login. Continue? [Y/N]: ::: Y
55
+ undo telnet server-source ~
56
+ dialog: Warning: The operation will delete the Telnet server source configuration and may cause the service to be unavailable. Do you want to continue? [Y/N]: ::: Y
57
+ dialog: Warning: The operation will delete the Telnet server source configuration and may cause the service to be unavailable. Continue? [Y/N]: ::: Y
58
+ undo telnet ipv6 server-source ~
59
+ dialog: Warning: The operation will delete the Telnet server source configuration and may cause the service to be unavailable. Do you want to continue? [Y/N]: ::: Y
60
+ dialog: Warning: The operation will delete the Telnet server source configuration and may cause the service to be unavailable. Continue? [Y/N]: ::: Y
61
+ telnet ipv6 server disable
62
+ dialog: Warning: The operation will stop the IPv6 Telnet server. Do you want to continue? [Y/N]: ::: Y
63
+ dialog: Warning: The operation will stop the IPv6 Telnet server. Continue? [Y/N]: ::: Y
64
+ telnet server disable
65
+ dialog: Warning: The operation will stop the Telnet server. Do you want to continue? [Y/N]: ::: Y
66
+ dialog: Warning: The operation will stop the Telnet server. Continue? [Y/N]: ::: Y
67
+ ssh ipv6 server-source all-interface
68
+ dialog: Warning: SSH server source configuration will take effect in the next login. Do you want to continue? [Y/N]: ::: Y
69
+ dialog: Warning: SSH server source configuration will take effect in the next login. Continue? [Y/N]: ::: Y
70
+ ssh server-source all-interface
71
+ dialog: Warning: SSH server source configuration will take effect in the next login. Do you want to continue? [Y/N]: ::: Y
72
+ dialog: Warning: SSH server source configuration will take effect in the next login. Continue? [Y/N]: ::: Y
73
+ undo ssh server-source ~
74
+ dialog: Warning: The operation will delete the SSH server source configuration and may cause the service to be unavailable. Do you want to continue? [Y/N]: ::: Y
75
+ undo protocol inbound ssh port *
76
+ dialog: Warning: The operation will stop the ssh port 830 service. Do you want to continue? [Y/N]: ::: Y
77
+ undo sftp server enable
78
+ dialog: Warning: The operation will stop the SFTP server. Do you want to continue? [Y/N]: ::: Y
79
+ (ftp|FTP) *
80
+ dialog: Warning: FTP server source configuration will take effect in the next login. Do you want to continue? [Y/N]: ::: Y
81
+ undo (ftp|FTP) server enable
82
+ dialog: Warning: The operation will stop the FTP server. Do you want to continue? [Y/N]: ::: Y
83
+ undo (ftp|FTP) ipv6 server enable
84
+ dialog: Warning: The operation will stop the FTP server. Do you want to continue? [Y/N]: ::: Y
85
+ undo (ftp|FTP) (server source|server-source)
86
+ dialog: Warning: The operation will delete the FTP server source configuration and may cause the service to be unavailable. Do you want to continue? [Y/N]: ::: Y
87
+ dialog: Warning: To make the server source configuration take effect, the FTP server will be restarted. Continue? [Y/N]: ::: Y
88
+ undo (ftp|FTP) ipv6 (server source|server-source)
89
+ dialog: Warning: The operation will delete the FTP server source configuration and may cause the service to be unavailable. Do you want to continue? [Y/N]: ::: Y
90
+ dialog: Warning: To make the server source configuration take effect, the FTP server will be restarted. Continue? [Y/N]: ::: Y
91
+ undo http server enable
92
+ dialog: Warning: The operation will stop HTTP service. Continue? [Y/N]: ::: Y
93
+ undo sftp * server enable
94
+ dialog: Warning: The operation will stop the SFTP server. Do you want to continue? [Y/N]: ::: Y
95
+ undo scp server enable
96
+ dialog: Warning: The operation will stop the SCP server. Continue? [Y/N]: ::: Y
97
+ undo scp * server enable
98
+ dialog: Warning: The operation will stop the SCP server. Continue? [Y/N]: ::: Y
99
+ undo dhcp enable
100
+ dialog: Warning: All DHCP functions will be disabled. Continue? [Y/N] ::: Y
101
+ undo dhcpv6 enable
102
+ dialog: Warning: All DHCPv6 functions will be disabled. Continue? [Y/N]: ::: Y
103
+ system tcam acl
104
+ dialog: Warning: Enabling the TCAM ACL will cause ACL resources to be replanned. Incorrectly using these commands will cause some services to be unavailable. Therefore, use these commands with the guidance of Huawei engineers. Continue? [Y/N] ::: Y
105
+ local-user * privilege level
106
+ dialog: Warning: This operation may affect online users, are you sure to change the user privilege level ?[Y/N] ::: Y
107
+ dialog: Warning: This operation may affect online users and will change the user privilege level, Continue? [Y/N]: ::: Y
108
+ local-user * password
109
+ dialog: Warning: The user using this account will be logged out, and needs to log in again. Do you want to continue? [Y/N] ::: Y
110
+
111
+ stp *
112
+ dialog: Warning: The global STP state will be changed. Continue? [Y/N] ::: Y
113
+
114
+ ntp server disable
115
+ dialog: /.*Continue\?/ ::: Y
116
+ ntp * server disable
117
+ dialog: /.*Continue\?/ ::: Y
118
+
119
+ ntp-service server disable
120
+ dialog: /.*Continue\?/ ::: Y
121
+ ntp-service * server disable
122
+ dialog: /.*Continue\?/ ::: Y
123
+
124
+ undo telnet server-source all-interface
125
+ dialog: /.*continue\?/ ::: Y
126
+ undo telnet ipv6 server-source all-interface
127
+ dialog: /.*continue\?/ ::: Y
128
+ telnet server disable
129
+ dialog: /.*continue\?/ ::: Y
130
+ telnet ipv6 server disable
131
+ dialog: /.*continue\?/ ::: Y
132
+
133
+ undo vlan
134
+ dialog: Warning: The configurations of the VLAN will be deleted. Continue? [Y/N]: ::: Y
135
+
136
+ port link-type *
137
+ dialog: Warning: This command will delete VLANs on this port. Continue?[Y/N]: ::: Y
138
+
139
+ port mode 200GE ~
140
+ dialog: /Warning: This operation will delete current ports.*/ ::: Y
141
+
142
+ port mode *
143
+ dialog: /Warning: The interfaces.* will be converted to .* mode/ ::: Y
144
+ undo port mode *
145
+ dialog: /Warning: The interfaces.* will be converted to .* mode/ ::: Y
146
+
147
+ mpls lsr-id *
148
+ dialog: Warning: All MPLS services will be deleted and services related to LSR-ID will fail. Continue? [Y/N]: ::: Y
149
+
150
+ undo router-id
151
+ dialog: Warning: Changing the parameter in this command resets the peer session. Continue? [Y/N]: ::: Y
152
+
153
+ router-id
154
+ dialog: Warning: Changing the parameter in this command resets the peer session. Continue? [Y/N]: ::: Y
155
+
156
+ undo bfd
157
+ dialog: Warning: The BFD process will be deleted. Continue? [Y/N]: ::: Y
158
+
159
+ undo dcn
160
+ dialog: Warning: This operation will disable DCN function. Continue? [Y/N]: ::: Y
161
+
162
+ undo ospf *
163
+ dialog: Warning: The OSPF process will be deleted. Continue? [Y/N]: ::: Y
164
+
165
+ undo mpls ldp transport-address
166
+ dialog: Warning: All the related sessions will be deleted if the operation is performed! Continue? [Y/N]: ::: Y
167
+
168
+ ldp-sync enable
169
+ dialog: Warning: This will cause all the interfaces enabled the ISIS process to enter ldp-sync state. Continue? [Y/N]: ::: Y
170
+ dialog: Warning: This will cause all the interfaces enabled the OSPF process to enter ldp-sync state. Continue? [Y/N]: ::: Y
171
+
172
+ association-type enable
173
+ dialog: Warning: The PCE sessions will be restarted. Continue? [Y/N]: ::: Y
174
+
175
+ info-center max-logfile-number *
176
+ dialog: Warning: The operation will probably delete the redundant logs. Continue? [Y/N]: ::: Y
177
+
178
+ rsa peer-public-key *
179
+ dialog: Do you really want to replace it? [Y/N]: ::: Y
180
+
181
+ ip binding vpn-instance
182
+ dialog: Warning: This operation will modify the router ID to 0.0.0.0, which may affect the establishment of BGP peer relationships. Continue? [Y/N]: ::: Y
183
+
184
+ force transceiver *
185
+ dialog: /.*Continue\?/ ::: Y
186
+
187
+ undo force transceiver *
188
+ dialog: /.*Continue\?/ ::: Y
189
+
190
+ undo local-aaa-user change-password verify
191
+ dialog: Warning: This command will disable the function of verifying the old password when administrators changes their own passwords. Continue?[Y/N] ::: Y
192
+
193
+ undo local-user ~
194
+ dialog: Warning: This operation may affect online users, are you sure to change the user privilege level ?[Y/N] ::: Y
195
+
196
+ # vim: set syntax=annrulebook:
@@ -0,0 +1,390 @@
1
+ # vim: set syntax=annrulebook:
2
+ # В этом файле определяется порядок команд, в котором их следует подавать на устройство.
3
+ # - Если порядок команды не важен - ее можно не писать сюда совсем.
4
+ # - Если команда начинается с undo и прописан параметр %order_reverse - команда считается
5
+ # обратной, но занимает место между прямыми там, где указано (т.е. undo vlan batch
6
+ # будет стоять после блоков interface).
7
+
8
+ sysname
9
+
10
+ m-lag
11
+
12
+ # переключаем режим BFD с софта на аппаратный
13
+ undo hardware-resource firmware-mode *
14
+ hardware-resource firmware-mode * %order_reverse
15
+
16
+ #clock
17
+ #info-center
18
+
19
+ # на vpn-instance OOB/MLAG есть много ссылок отовсюду, так что создадим как можно раньше
20
+ ip vpn-instance */[OoMm][OoLl][BbAa].*/
21
+
22
+ #ntp
23
+ #dns
24
+
25
+ #mac-address timer aging
26
+
27
+ #rsa
28
+ #ecc
29
+
30
+ # из-за того, что h3c не позволяет иметь в одном prefix-list 2 одинаковых правила,
31
+ # нужно сначала удалить все несовпадающие, а затем заполнить их заново
32
+ # в таком случае нужно расскомментить эту строчку, но она не позволяет снести plist целиком
33
+ # сначала мы добавляем stub-правило в рулсет чтобы оно не позволяло prefix-list'у "пропасть"
34
+ # индекс референсится в логике патчинга префикс-листа h3c.misc.prefix_list
35
+ */(ip|ipv6)/ prefix-list * index 99999999
36
+ undo */(ip|ipv6)/ prefix-list * index * %order_reverse
37
+ */(ip|ipv6)/ prefix-list
38
+
39
+ # common block для фабрики
40
+ bfd peer-ip
41
+ ip unreachables
42
+ ip ttl-expires
43
+ lldp global
44
+ vxlan vlan-based
45
+ stp global
46
+ l2vpn enable
47
+ vxlan tunnel mac-learning
48
+ vxlan tunnel arp-learning
49
+ hardware-resource vxlan
50
+ vxlan ip-forwarding
51
+
52
+
53
+ line vty
54
+ ~
55
+ ssh server
56
+ netconf ssh server
57
+ sftp server
58
+ scp server
59
+
60
+ # далее если у нас МЛАГ надо это указать vvtep
61
+ evpn m-lag group 10.203.78.1
62
+
63
+ # дальше идут тенанты vsi
64
+ vsi
65
+
66
+ ip vpn-instance
67
+ route-distinguisher
68
+ address-family evpn
69
+ ~
70
+ address-family ipv4
71
+ ~
72
+ address-family ipv6
73
+ ~
74
+ ~
75
+
76
+ # это должно идти после vpn-instance
77
+ ntp
78
+
79
+ #stp mode
80
+ #stp bpdu-protection
81
+ #stp enable
82
+ #stp region-configuration
83
+
84
+ acl port-pool
85
+ acl ip-pool
86
+ acl ipv6-pool
87
+ acl ~
88
+ undo rule * description %order_reverse
89
+ undo rule ~ %order_reverse
90
+ rule * */deny|permit/
91
+ rule * description
92
+
93
+ system tcam
94
+
95
+ undo system tcam acl template * all %order_reverse
96
+ undo system tcam acl template * %order_reverse
97
+ undo system tcam acl$ %order_reverse
98
+
99
+ traffic classifier
100
+ traffic behavior
101
+ traffic policy
102
+ qos group
103
+ qos schedule-profile
104
+ port-wred
105
+
106
+ dhcp
107
+
108
+ vlan all
109
+ vlan
110
+
111
+ hwtacacs-server
112
+ hwtacacs server
113
+ radius-server
114
+
115
+ local-user ~
116
+ password hash * %logic=h3c.aaa.user
117
+ service-type ~
118
+ ~ %global
119
+
120
+ ssh user
121
+
122
+ user-interface
123
+ drop-profile
124
+
125
+ interface */(?i)(M-GigabitEthernet[^.]*)[^.]\d*$/
126
+ FTP client
127
+ ftp client
128
+ sflow
129
+
130
+ # SR глобально -> MPLS -> IS-IS -> IS-IS и SID на интерфейсах
131
+ segment-routing
132
+ sr-te policy *
133
+ candidate-path * *
134
+ undo segment-list * %order_reverse
135
+ undo segment-list * %order_reverse
136
+
137
+ # Сначала глобально mpls включаем, потом на интерфейсы
138
+ mpls
139
+ mpls te cspf
140
+ mpls te cspf preferred-igp
141
+
142
+ mpls ldp
143
+ mpls ldp remote-peer *
144
+
145
+ explicit-path
146
+
147
+ vsi *
148
+ mtu
149
+ vxlan
150
+ evpn encapsulation vxlan
151
+ route-distinguisher
152
+ vpn-target
153
+
154
+ interface */Vsi\d+/
155
+ interface */Bridge-Aggregation\d+/
156
+ interface */LoopBack\d+/
157
+
158
+ interface *
159
+ port link-mode * %order_reverse
160
+ undo ip address * * sub %order_reverse
161
+ undo ip address * * %order_reverse
162
+ description
163
+ port link-mode * %order_reverse
164
+ ip binding
165
+ ipv6 enable
166
+ ipv6 nd ra prefix
167
+ ipv6
168
+ ip address * *
169
+ ip address * * sub
170
+ dhcpv6
171
+ isis enable
172
+ isis
173
+ undo isis *
174
+ undo isis enable %order_reverse
175
+ mpls
176
+ mpls ldp
177
+ mpls ldp transport-address interface
178
+ mpls rsvp-te
179
+ mpls rsvp-te bfd
180
+ port link-type
181
+ port trunk pvid
182
+ port trunk permit
183
+ undo port trunk permit vlan all
184
+ undo port trunk permit vlan 1 %order_reverse
185
+ port hybrid
186
+ undo port hybrid vlan
187
+ port hybrid tagged
188
+ port hybrid untagged
189
+ port hybrid vlan
190
+ port hybrid pvid
191
+ voice-vlan */\d+/
192
+ voice-vlan
193
+ undo port link-aggregation
194
+ port link-aggregation
195
+ mode
196
+ qos (wfq|drr)
197
+ qos queue
198
+ vrrp6 vrid [11|12] virtual-ip FE80*
199
+ vrrp6 vrid [11|12] virtual-ip
200
+ vrrp6 vrid [11|12]
201
+ vrrp vrid [11|12] virtual-ip
202
+ vrrp vrid [11|12]
203
+ ~
204
+ poe
205
+
206
+ # Нужно чтобы subif'ы портов шли после конфигурации самих портов, иначе свитч ругнется на то что порт l2
207
+ interface */\S+\.\d+/
208
+
209
+ # Некоторые команды требуют сначала определить конфигурацию на L2 интерфейсах, а потом уже на vlanif
210
+ interface */Vlan-interface\d+/
211
+
212
+ # Должны быть после interface потому что в нем ссылается traffic-policy
213
+ # И именно в данном порядке
214
+ # policy ссылаются на behavior и classifier, они на acl'и
215
+ undo qos group %order_reverse
216
+ undo qos schedule-profile %order_reverse
217
+ undo traffic policy %order_reverse
218
+ undo traffic behavior %order_reverse
219
+ undo traffic classifier %order_reverse
220
+
221
+ # Должен быть после interface потому что в нем ссылается на diffserv domain
222
+ undo diffserv domain * %order_reverse
223
+
224
+ # маршруты идут после интерфейсов
225
+ ip route-static
226
+ ipv6 route-static
227
+
228
+ route-policy
229
+
230
+ ospf
231
+ opaque-capability enable
232
+ area
233
+
234
+ bgp
235
+ router-id
236
+ graceful-restart
237
+ timer keepalive
238
+ # [NOCDEV-1182] у load-balancing есть несколько взаимоисключающих флейверов
239
+ undo undo maximum load-balancing %order_reverse
240
+ maximum load-balancing
241
+ # [NOCDEV-2043] Тут только декларируем пиров и группы
242
+ # поскольку на них есть ссылки из family блоков
243
+ group
244
+ peer * as-number *
245
+ peer * local-as *
246
+ address-family ipv[46]|l2vpn evpn
247
+ balance
248
+ pic
249
+ additional-paths
250
+ import-route
251
+ group
252
+ peer * as-number *
253
+ peer * enable
254
+ peer * ~
255
+ l2vpn-ad-family
256
+ peer * enable
257
+ peer * ~
258
+ # [NOCDEV-2043] Остальное в глобальном блоке делаем тут
259
+ undo peer * description %order_reverse
260
+ undo peer * * * %order_reverse
261
+ undo peer * * %order_reverse
262
+ undo peer * %order_reverse
263
+ undo group * %order_reverse
264
+ peer * ~
265
+
266
+
267
+ # Вырубаем bfd после bgp, но до vpn
268
+ undo bfd * %order_reverse
269
+ undo bfd %order_reverse
270
+
271
+ undo ip vpn-instance %order_reverse
272
+ undo route-policy %order_reverse
273
+ undo route-policy */VRF_.*/ %order_reverse
274
+ undo ip community-filter %order_reverse
275
+ undo ip extcommunity-filter %order_reverse
276
+ undo ip as-path-filter %order_reverse
277
+
278
+ # Вырубаем bfd после bgp
279
+ undo bfd * %order_reverse
280
+ undo bfd %order_reverse
281
+
282
+ info-center
283
+
284
+ # Should be after acl definition
285
+ snmp-agent sys-info
286
+ snmp-agent mib-view
287
+ snmp-agent community complexity-check
288
+ snmp-agent community
289
+ snmp-agent target-host
290
+ snmp-agent trap source
291
+ snmp-agent
292
+ #ifindex constant
293
+
294
+ cpu-defend policy
295
+ cpu-defend-policy
296
+ slot *
297
+ cpu-defend-policy %order_reverse
298
+ undo cpu-defend policy %order_reverse
299
+
300
+ ssh server rsa-key min-length
301
+ rsa peer-public-key
302
+ ssh user
303
+ ssh user * assign
304
+ ssh user * authentication-type
305
+ ssh user * service-type
306
+
307
+ local-user * password
308
+ local-user * service-type
309
+ local-user * level
310
+ local-user * ftp-directory
311
+
312
+ stelnet server
313
+ stelnet ipv4 server
314
+ stelnet ipv6 server
315
+
316
+ telnet server acl
317
+ ssh server acl
318
+ */(ftp|FTP)/ server acl
319
+ */(ftp|FTP)/ acl
320
+ telnet ipv6 server acl
321
+ ssh ipv6 server acl
322
+ */(ftp|FTP)/ ipv6 server acl
323
+ */(ftp|FTP)/ ipv6 acl
324
+
325
+ ssh server-source all-interface
326
+ ssh ipv6 server-source all-interface
327
+ telnet server-source all-interface
328
+ telnet ipv6 server-source all-interface
329
+
330
+ #lldp
331
+
332
+ #stelnet
333
+ #ssh
334
+
335
+ #header
336
+
337
+ #command-privilege
338
+ #user-interface maximum-vty
339
+ #user-interface
340
+
341
+ domain
342
+ default-domain
343
+ telemetry
344
+ sensor-group *
345
+ destination-group *
346
+ subscription *
347
+
348
+ diffserv domain *
349
+ ip-dscp-inbound ~
350
+
351
+ #Удаляем acl в самом конце
352
+ undo acl %order_reverse
353
+
354
+ # Удаляем iface совсем в конце
355
+ # сначала subif
356
+ undo interface */.*[.]\d+/ %order_reverse
357
+ # vlanif
358
+ undo interface */Vlanif\d+/ %order_reverse
359
+ undo interface */Vbdif\d+/ %order_reverse
360
+
361
+ # удалять eth-trunk можно только после того, как вычистим member interfaces
362
+ undo interface */Eth-Trunk\d+/ %order_reverse
363
+ undo interface %order_reverse
364
+
365
+ # interface Tunnel* ссылается на 'explicit-path'
366
+ undo interface */Tunnel.*/ %order_reverse
367
+ undo explicit-path %order_reverse
368
+
369
+ # drop-profile можно удалять только после удаления референсов на него в интерфейсах
370
+ undo drop-profile %order_reverse
371
+
372
+ # vlan'ы удаляем после vlanif/subif
373
+ undo vlan %order_reverse
374
+ undo vlan batch %order_reverse
375
+ undo observe-port %order_reverse
376
+
377
+ #sflow может висеть а subif/eth-trunk
378
+ undo sflow %order_reverse
379
+
380
+ # Данное стаб-правило должно удаляться в самую посленюю очередь
381
+ # поскольку если префикс-лист должен уходить из конфигурации полностью
382
+ # перед этим должны быть удалены все его референсы в конфиге
383
+ # индекс референсится в логике патчинга префикс-листа h3c.misc.prefix_list
384
+ undo */(ip|ipv6)/ prefix-list * index 99999999 %order_reverse
385
+
386
+ #remove template only after all references will be cleared
387
+ undo radius-server template %order_reverse
388
+ undo hwtacacs-server template %order_reverse
389
+
390
+ ~