From cf998c040c371be20be8035895989fcee3c06429 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 27 Apr 2021 22:12:11 +0200 Subject: op-mode: ospfv3: T3335: re-use common vtysh_wrapper.sh wrapper Instead of renaming the OSPFv3 commands for every individual XML invocation, also re-use the common helper shell script. One source, one truth! --- .../include/ospfv3-adv-router-id-node-tag.xml.i | 17 -- .../include/ospfv3-adv-router.xml.i | 16 -- op-mode-definitions/include/ospfv3-detail.xml.i | 9 - op-mode-definitions/include/ospfv3-dump.xml.i | 9 - op-mode-definitions/include/ospfv3-internal.xml.i | 9 - .../include/ospfv3-linkstate-id-node-tag.xml.i | 18 -- .../include/ospfv3-linkstate-id.xml.i | 15 - .../include/ospfv3-self-originated.xml.i | 14 - .../include/ospfv3/adv-router-id-node-tag.xml.i | 16 ++ .../include/ospfv3/adv-router.xml.i | 16 ++ op-mode-definitions/include/ospfv3/detail.xml.i | 8 + op-mode-definitions/include/ospfv3/dump.xml.i | 8 + op-mode-definitions/include/ospfv3/internal.xml.i | 8 + .../include/ospfv3/linkstate-id-node-tag.xml.i | 17 ++ .../include/ospfv3/linkstate-id.xml.i | 15 + .../include/ospfv3/self-originated.xml.i | 13 + op-mode-definitions/show-ipv6-ospfv3.xml.in | 309 +++++++++++---------- src/op_mode/vtysh_wrapper.sh | 3 +- 18 files changed, 261 insertions(+), 259 deletions(-) delete mode 100644 op-mode-definitions/include/ospfv3-adv-router-id-node-tag.xml.i delete mode 100644 op-mode-definitions/include/ospfv3-adv-router.xml.i delete mode 100644 op-mode-definitions/include/ospfv3-detail.xml.i delete mode 100644 op-mode-definitions/include/ospfv3-dump.xml.i delete mode 100644 op-mode-definitions/include/ospfv3-internal.xml.i delete mode 100644 op-mode-definitions/include/ospfv3-linkstate-id-node-tag.xml.i delete mode 100644 op-mode-definitions/include/ospfv3-linkstate-id.xml.i delete mode 100644 op-mode-definitions/include/ospfv3-self-originated.xml.i create mode 100644 op-mode-definitions/include/ospfv3/adv-router-id-node-tag.xml.i create mode 100644 op-mode-definitions/include/ospfv3/adv-router.xml.i create mode 100644 op-mode-definitions/include/ospfv3/detail.xml.i create mode 100644 op-mode-definitions/include/ospfv3/dump.xml.i create mode 100644 op-mode-definitions/include/ospfv3/internal.xml.i create mode 100644 op-mode-definitions/include/ospfv3/linkstate-id-node-tag.xml.i create mode 100644 op-mode-definitions/include/ospfv3/linkstate-id.xml.i create mode 100644 op-mode-definitions/include/ospfv3/self-originated.xml.i diff --git a/op-mode-definitions/include/ospfv3-adv-router-id-node-tag.xml.i b/op-mode-definitions/include/ospfv3-adv-router-id-node-tag.xml.i deleted file mode 100644 index 312ce2a4f..000000000 --- a/op-mode-definitions/include/ospfv3-adv-router-id-node-tag.xml.i +++ /dev/null @@ -1,17 +0,0 @@ - - - - Search by Advertising Router ID - - <x.x.x.x> - - - - vtysh -c "show ipv6 ospf6 ${@:4}" - - #include - #include - #include - - - diff --git a/op-mode-definitions/include/ospfv3-adv-router.xml.i b/op-mode-definitions/include/ospfv3-adv-router.xml.i deleted file mode 100644 index d17538d4d..000000000 --- a/op-mode-definitions/include/ospfv3-adv-router.xml.i +++ /dev/null @@ -1,16 +0,0 @@ - - - - Search by Advertising Router ID - - <x.x.x.x> - - - - #include - #include - #include - #include - - - diff --git a/op-mode-definitions/include/ospfv3-detail.xml.i b/op-mode-definitions/include/ospfv3-detail.xml.i deleted file mode 100644 index 76096fbc8..000000000 --- a/op-mode-definitions/include/ospfv3-detail.xml.i +++ /dev/null @@ -1,9 +0,0 @@ - - - - Show detailed information - - - vtysh -c "show ipv6 ospf6 ${@:4}" - - diff --git a/op-mode-definitions/include/ospfv3-dump.xml.i b/op-mode-definitions/include/ospfv3-dump.xml.i deleted file mode 100644 index 4271aec53..000000000 --- a/op-mode-definitions/include/ospfv3-dump.xml.i +++ /dev/null @@ -1,9 +0,0 @@ - - - - Show dump of LSAs - - - vtysh -c "show ipv6 ospf6 ${@:4}" - - diff --git a/op-mode-definitions/include/ospfv3-internal.xml.i b/op-mode-definitions/include/ospfv3-internal.xml.i deleted file mode 100644 index 8b45e86c1..000000000 --- a/op-mode-definitions/include/ospfv3-internal.xml.i +++ /dev/null @@ -1,9 +0,0 @@ - - - - Show internal LSA information - - - vtysh -c "show ipv6 ospf6 ${@:4}" - - diff --git a/op-mode-definitions/include/ospfv3-linkstate-id-node-tag.xml.i b/op-mode-definitions/include/ospfv3-linkstate-id-node-tag.xml.i deleted file mode 100644 index 24b549d28..000000000 --- a/op-mode-definitions/include/ospfv3-linkstate-id-node-tag.xml.i +++ /dev/null @@ -1,18 +0,0 @@ - - - - Search by Link state ID - - <x.x.x.x> - - - - vtysh -c "show ipv6 ospf6 ${@:4}" - - #include - #include - #include - #include - - - diff --git a/op-mode-definitions/include/ospfv3-linkstate-id.xml.i b/op-mode-definitions/include/ospfv3-linkstate-id.xml.i deleted file mode 100644 index eab5916f1..000000000 --- a/op-mode-definitions/include/ospfv3-linkstate-id.xml.i +++ /dev/null @@ -1,15 +0,0 @@ - - - - Search by Link state ID - - <x.x.x.x> - - - - #include - #include - #include - - - diff --git a/op-mode-definitions/include/ospfv3-self-originated.xml.i b/op-mode-definitions/include/ospfv3-self-originated.xml.i deleted file mode 100644 index 180bca6f6..000000000 --- a/op-mode-definitions/include/ospfv3-self-originated.xml.i +++ /dev/null @@ -1,14 +0,0 @@ - - - - Show Self-originated LSAs - - - vtysh -c "show ipv6 ospf6 ${@:4}" - - #include - #include - #include - - - diff --git a/op-mode-definitions/include/ospfv3/adv-router-id-node-tag.xml.i b/op-mode-definitions/include/ospfv3/adv-router-id-node-tag.xml.i new file mode 100644 index 000000000..a1bd67a90 --- /dev/null +++ b/op-mode-definitions/include/ospfv3/adv-router-id-node-tag.xml.i @@ -0,0 +1,16 @@ + + + + Search by Advertising Router ID + + <x.x.x.x> + + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + #include + #include + #include + + + diff --git a/op-mode-definitions/include/ospfv3/adv-router.xml.i b/op-mode-definitions/include/ospfv3/adv-router.xml.i new file mode 100644 index 000000000..a14fc39db --- /dev/null +++ b/op-mode-definitions/include/ospfv3/adv-router.xml.i @@ -0,0 +1,16 @@ + + + + Search by Advertising Router ID + + <x.x.x.x> + + + + #include + #include + #include + #include + + + diff --git a/op-mode-definitions/include/ospfv3/detail.xml.i b/op-mode-definitions/include/ospfv3/detail.xml.i new file mode 100644 index 000000000..4e3c91268 --- /dev/null +++ b/op-mode-definitions/include/ospfv3/detail.xml.i @@ -0,0 +1,8 @@ + + + + Show detailed information + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/ospfv3/dump.xml.i b/op-mode-definitions/include/ospfv3/dump.xml.i new file mode 100644 index 000000000..55e10a5ee --- /dev/null +++ b/op-mode-definitions/include/ospfv3/dump.xml.i @@ -0,0 +1,8 @@ + + + + Show dump of LSAs + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/ospfv3/internal.xml.i b/op-mode-definitions/include/ospfv3/internal.xml.i new file mode 100644 index 000000000..ac7c61e6f --- /dev/null +++ b/op-mode-definitions/include/ospfv3/internal.xml.i @@ -0,0 +1,8 @@ + + + + Show internal LSA information + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/ospfv3/linkstate-id-node-tag.xml.i b/op-mode-definitions/include/ospfv3/linkstate-id-node-tag.xml.i new file mode 100644 index 000000000..ee3863b35 --- /dev/null +++ b/op-mode-definitions/include/ospfv3/linkstate-id-node-tag.xml.i @@ -0,0 +1,17 @@ + + + + Search by Link state ID + + <x.x.x.x> + + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + #include + #include + #include + #include + + + diff --git a/op-mode-definitions/include/ospfv3/linkstate-id.xml.i b/op-mode-definitions/include/ospfv3/linkstate-id.xml.i new file mode 100644 index 000000000..9ead17c20 --- /dev/null +++ b/op-mode-definitions/include/ospfv3/linkstate-id.xml.i @@ -0,0 +1,15 @@ + + + + Search by Link state ID + + <x.x.x.x> + + + + #include + #include + #include + + + diff --git a/op-mode-definitions/include/ospfv3/self-originated.xml.i b/op-mode-definitions/include/ospfv3/self-originated.xml.i new file mode 100644 index 000000000..734f3f8ad --- /dev/null +++ b/op-mode-definitions/include/ospfv3/self-originated.xml.i @@ -0,0 +1,13 @@ + + + + Show Self-originated LSAs + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + #include + #include + #include + + + diff --git a/op-mode-definitions/show-ipv6-ospfv3.xml.in b/op-mode-definitions/show-ipv6-ospfv3.xml.in index 9227fdae1..e6c8a6700 100644 --- a/op-mode-definitions/show-ipv6-ospfv3.xml.in +++ b/op-mode-definitions/show-ipv6-ospfv3.xml.in @@ -26,7 +26,7 @@ protocols ospfv3 area - vtysh -c "show ipv6 ospf6 area $4 spf tree" + vtysh -c "show ipv6 ospf6 area $5 spf tree" @@ -43,9 +43,9 @@ Show OSPFv3 border-router (ABR and ASBR) information - vtysh -c "show ipv6 ospf6 border-routers" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include @@ -55,13 +55,13 @@ <x.x.x.x> - vtysh -c "show ipv6 ospf6 border-routers $5" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ Show OSPFv3 Link state database information - vtysh -c "show ipv6 ospf6 database" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ @@ -71,7 +71,7 @@ - #include + #include @@ -87,9 +87,9 @@ - #include - #include - #include + #include + #include + #include @@ -103,19 +103,19 @@ vtysh -c "show ipv6 ospf6 database * $6" - #include - #include - #include - #include + #include + #include + #include + #include Show AS-External LSAs - vtysh -c "show ipv6 ospf6 database as-external" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include Search by Advertising Router ID @@ -125,16 +125,16 @@ vtysh -c "show ipv6 ospf6 database as-external * $7" - #include - #include - #include + #include + #include + #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include @@ -145,159 +145,150 @@ - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include - #include - #include - #include - #include + #include + #include + #include + #include Show Group-Membership LSAs - - vtysh -c "show ipv6 ospf6 ${@:4}" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include - #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include + #include + #include Show Inter-Area-Prefix LSAs - - vtysh -c "show ipv6 ospf6 ${@:4}" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include - #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include + #include + #include Show Inter-Area-Router LSAs - - vtysh -c "show ipv6 ospf6 ${@:4}" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include - #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include + #include + #include Show Intra-Area-Prefix LSAs - - vtysh -c "show ipv6 ospf6 ${@:4}" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include - #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include + #include + #include Show Link LSAs - - vtysh -c "show ipv6 ospf6 ${@:4}" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include - #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include + #include + #include Show Network LSAs - - vtysh -c "show ipv6 ospf6 ${@:4}" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include - #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include + #include + #include Show LSAs - - vtysh -c "show ipv6 ospf6 ${@:4}" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include - #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include + #include + #include Show router LSAs - - vtysh -c "show ipv6 ospf6 ${@:4}" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include - #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include + #include + #include Show Type-7 LSAs - - vtysh -c "show ipv6 ospf6 ${@:4}" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include - #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include + #include + #include @@ -306,15 +297,15 @@ Show OSPFv3 interface information - vtysh -c "show ipv6 ospf6 interface" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ Show connected prefixes to advertise - vtysh -c "show ipv6 ospf6 interface prefix" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include @@ -324,14 +315,14 @@ <h:h:h:h:h:h:h:h> <h:h:h:h:h:h:h:h/x> - vtysh -c "show ipv6 ospf6 interface prefix $6" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include Matched interface prefix information - vtysh -c "show ipv6 ospf6 interface prefix $6 match" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ @@ -344,15 +335,15 @@ - vtysh -c "show ipv6 ospf6 interface $5" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ Show connected prefixes to advertise - vtysh -c "show ipv6 ospf6 interface $5 prefix" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include @@ -362,14 +353,14 @@ <h:h:h:h:h:h:h:h> <h:h:h:h:h:h:h:h/x> - vtysh -c "show ipv6 ospf6 interface $5 prefix $7" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include Matched interface prefix information - vtysh -c "show ipv6 ospf6 interface $5 prefix $7 match" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ @@ -380,33 +371,49 @@ Show OSPFv3 linkstate routing information - #include - + #include + Show linkstate Network information + + <x.x.x.x> + - vtysh -c "show ipv6 ospf6 linkstate network" - - + + + + Specify Link state ID as IPv4 address notation + + <x.x.x.x> + + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + + Show linkstate Router information + + <x.x.x.x> + - vtysh -c "show ipv6 ospf6 linkstate router" - + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + Show OSPFv3 neighbor information - vtysh -c "show ipv6 ospf6 neighbor" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include Show neighbor DR choice information - vtysh -c "show ipv6 ospf6 neighbor drchoice" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ @@ -414,56 +421,56 @@ Show OSPFv3 redistribute external information - vtysh -c "show ipv6 ospf6 redistribute" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ Show OSPFv3 routing table information - vtysh -c "show ipv6 ospf6 route" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ Show Type-1 External route information - vtysh -c "show ipv6 ospf6 route external-1" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include Show Type-2 External route information - vtysh -c "show ipv6 ospf6 route external-2" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include Show Inter-Area route information - vtysh -c "show ipv6 ospf6 route inter-area" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include Show Intra-Area route information - vtysh -c "show ipv6 ospf6 route intra-area" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include - #include + #include Show route table summary - vtysh -c "show ipv6 ospf6 route summary" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ @@ -474,21 +481,21 @@ <h:h:h:h:h:h:h:h> <h:h:h:h:h:h:h:h/x> - vtysh -c "show ipv6 ospf6 route $5" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ Show routes longer than specified prefix - vtysh -c "show ipv6 ospf6 route $5 longer" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ Show routes matching specified prefix - vtysh -c "show ipv6 ospf6 route $5 match" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - #include + #include diff --git a/src/op_mode/vtysh_wrapper.sh b/src/op_mode/vtysh_wrapper.sh index 47d88330b..09980e14f 100755 --- a/src/op_mode/vtysh_wrapper.sh +++ b/src/op_mode/vtysh_wrapper.sh @@ -1,4 +1,5 @@ #!/bin/sh declare -a tmp -tmp=$@ +# FRR uses ospf6 where we use ospfv3, thus alter the command +tmp=$(echo $@ | sed -e "s/ospfv3/ospf6/") vtysh -c "$tmp" -- cgit v1.2.3