From cd89516a28f4de85f844a232cb1b40b198218856 Mon Sep 17 00:00:00 2001 From: Naoto Hanaue Date: Fri, 3 Jul 2015 17:48:51 +0900 Subject: doc: add examples to cli-command-syntax.md --- docs/sources/cli-command-syntax.md | 215 ++++++++++++++++++++++++++++++------- 1 file changed, 175 insertions(+), 40 deletions(-) (limited to 'docs') diff --git a/docs/sources/cli-command-syntax.md b/docs/sources/cli-command-syntax.md index 9be898ab..730d712e 100644 --- a/docs/sources/cli-command-syntax.md +++ b/docs/sources/cli-command-syntax.md @@ -13,9 +13,9 @@ gobgp has three subcommands. - policy -## global subcommand - -### Operations for Global-Rib - add/del/show - +## 1. global subcommand +### 1.1. Operations for Global-Rib - add/del/show - +#### - syntax ```shell # add Route % gobgp global rib add [-a
] @@ -26,23 +26,38 @@ gobgp has three subcommands. # show a specific route information % gobgp global rib [|] [-a
] ``` - - **Option** - - \-a , \-\-address-family: specify the ipv4, ipv6, evpn, encap, or rtc -
+#### - example +If you want to add routes with the address of the ipv4 to global rib: +```shell +% gobgp global rib add 10.33.0.0 -a ipv4 +``` +If you want to remove routes with the address of the ipv6 from global rib: +```shell +% gobgp global rib del 2001:123:123:1::/64 -a ipv6 +``` + +#### - option +The following options can be specified in the global subcommand: + +| short |long | description | +|--------|---------------|--------------------------------------------| +|a |address-family |specify the ipv4, ipv6, evpn, encap, or rtc | +
-## neighbor subcommand -### Show Neighbor Status +## 2. neighbor subcommand +### 2.1. Show Neighbor Status +#### - syntax ```shell # show neighbor's status as list % gobgp neighbor - # show status of a specific neighbor % gobgp neighbor ``` -### Operations for neighbor - shutdown/reset/softreset/enable/disable - +### 2.2. Operations for neighbor - shutdown/reset/softreset/enable/disable - +#### - syntax ```shell % gobgp neighbor shutdown % gobgp neighbor reset @@ -52,27 +67,46 @@ gobgp has three subcommands. % gobgp neighbor enable % gobgp neighbor disable ``` - - **Option** - - \-a , \-\-address-family: specify the ipv4 or ipv6 +#### - option + The following options can be specified in the neighbor subcommand: + +| short |long | description | +|--------|---------------|------------------------------| +|a |address-family |specify the ipv4 or ipv6 | + -### Show Rib - local-rib/adj-rib-in/adj-rib-out - +### 2.3. Show Rib - local-rib/adj-rib-in/adj-rib-out - +#### - syntax ```shell # show all routes in [local|adj-in|adj-out] table % gobgp neighbor [local|adj-in|adj-out] [-a
] # show a specific route in [local|adj-in|adj-out] table % gobgp neighbor [local|adj-in|adj-out] [|] [-a
] ``` - - **Option** - - \-a , \-\-address-family: specify the ipv4 or ipv6 -### Operations for Policy - add/del/show - +#### - example +If you want to show the local rib of ipv4 that neighbor(10.0.0.1) has: +```shell +% gobgp neighbor 10.0.0.1 local -a ipv4 +``` + +#### - option +The following options can be specified in the neighbor subcommand: + +| short |long | description | +|--------|---------------|------------------------------| +|a |address-family |specify the ipv4 or ipv6 | + + +### 2.4. Operations for Policy - add/del/show - +#### - syntax ```shell # add policy to import-policy configuration -% gobgp neighbor policy add import +% gobgp neighbor policy add import # add policy to export-policy configuration -% gobgp neighbor policy add export +% gobgp neighbor policy add export # add policy to distribute-policy configuration -% gobgp neighbor policy add distribute +% gobgp neighbor policy add distribute # delete import-policy configuration from specific neighbor % gobgp neighbor policy del import # delete export-policy configuration from specific neighbor @@ -83,13 +117,24 @@ gobgp has three subcommands. % gobgp neighbor policy ``` +#### - example +If you want to add the import policy to neighbor(10.0.0.1): +```shell +% gobgp neighbor 10.0.0.1 policy add import policy1,policy2 accept +``` +You can specify multiple policy to neighbor separated by commas. + +\ means the operation(accept | reject) in the case where the route does not match the conditions of the policy. + +
-## policy subcommand -### Operations for PrefixSet - add/del/show - +## 3. policy subcommand +### 3.1. Operations for PrefixSet - add/del/show - +#### - syntax ```shell # add PrefixSet -% gobgp policy prefix add +% gobgp policy prefix add [] # delete all PrefixSet % gobgp policy prefix del all # delete a specific PrefixSet @@ -100,7 +145,22 @@ gobgp has three subcommands. % gobgp policy prefix ``` -### Operations for NeighborSet - add/del/show - +#### - example +If you want to add the PrefixSet: +```shell +% gobgp policy prefix add ps1 10.33.0.0/16 16..24 +``` +A PrefixSet it is possible to have multiple prefix, if you want to remove the PrefixSet to specify only PrefixSet name. +```shell +% gobgp policy prefix del ps1 +``` +If you want to remove one element(prefix) of PrefixSet, to specify a prefix in addition to the PrefixSet name. +```shell +% gobgp policy prefix del ps1 10.33.0.0/16 +``` + +### 3.2. Operations for NeighborSet - add/del/show - +#### - syntax ```shell # add NeighborSet % gobgp policy neighbor add @@ -114,7 +174,22 @@ gobgp has three subcommands. % gobgp policy neighbor ``` -### Operations for AsPathSet - add/del/show - +#### - example +If you want to add the NeighborSet: +```shell +% gobgp policy neighbor add ns1 10.0.0.1 +``` +A NeighborSet it is possible to have multiple address, if you want to remove the NeighborSet to specify only NeighborSet name. +```shell +% gobgp policy neighbor del ns1 +``` +If you want to remove one element(address) of NeighborSet, to specify a address in addition to the NeighborSet name. +```shell +% gobgp policy prefix del ns1 10.0.0.1 +``` + +### 3.3. Operations for AsPathSet - add/del/show - +#### - syntax ```shell # add AsPathSet % gobgp policy aspath add @@ -128,7 +203,28 @@ gobgp has three subcommands. % gobgp policy aspath ``` -### Operations for CommunitySet - add/del/show - +#### - example +If you want to add the AsPathSet: +```shell +% gobgp policy aspath add ass1 ^65100 +``` + You can specify the position using regexp-like expression as follows: + - From: "^65100" means the route is passed from AS 65100 directly. + - Any: "65100" means the route comes through AS 65100. + - Origin: "65100$" means the route is originated by AS 65100. + - Only: "^65100$" means the route is originated by AS 65100 and comes from it directly. + +An AsPathSet it is possible to have multiple as path, if you want to remove the AsPathSet to specify only AsPathSet name. +```shell +% gobgp policy aspath del ass1 +``` +If you want to remove one element(as path) of AsPathSet, to specify an as path in addition to the AsPathSet name. +```shell +% gobgp policy aspath del ass1 ^65100 +``` + +### 3.4. Operations for CommunitySet - add/del/show - +#### - syntax ```shell # add CommunitySet % gobgp policy community add @@ -142,8 +238,25 @@ gobgp has three subcommands. % gobgp policy community ``` +#### - example +If you want to add the CommunitySet: +```shell +% gobgp policy community add cs1 65100:10 +``` + You can specify the position using regexp-like expression as follows: + - 6[0-9]+:[0-9]+ + +A CommunitySet it is possible to have multiple community, if you want to remove the CommunitySet to specify only CommunitySet name. +```shell +% gobgp policy neighbor del cs1 +``` +If you want to remove one element(community) of CommunitySet, to specify a address in addition to the CommunitySet name. +```shell +% gobgp policy prefix del cs1 65100:10 +``` -### Operations for RoutePolicy - add/del/show - +### 3.5. Operations for RoutePolicy - add/del/show - +#### - syntax ```shell # add RoutePolicy % gobgp policy routepoilcy add [] @@ -156,20 +269,42 @@ gobgp has three subcommands. # show a specific RoutePolicy information % gobgp policy routepoilcy ``` - - **Option (Conditon)** - Specify the options of condition when you use the routepolicy add subcommand. - - \-\-c-prefix : specify the name that added prefix set in PrefixSet subcommand - - \-\-c-neighbor : specify the name that added neighbor set in NeighborSet subcommand - - \-\-c-aspath : specify the name that added as path set in AsPathSet subcommand - - \-\-c-community : specify the name that added community set in CommunitySet subcommand - - \-\-c-aslen : specify the operator(eq, ge, le) and value(numric) - - \-\-c-option : specify the match option(any, all, invert) +#### - example +If you want to add the RoutePolicy: +```shell +% gobgp policy routepolicy add policy1 state1 --c-prefix=ps1 --c-neighbor=ns1 --c-aspath=ass1 --c-community=cs1 --c-aslen=eq,3 --c-option=all --a-route=reject --a-community=ADD[65100:20] --a-med=+100 +``` +However, it is not necessary to specify all of the options at once. -
- - **Option (Action)** - Specify the options of action when you use the routepolicy add subcommand. - - \-\-a-route : specify the action(accept, reject) of the route that match to the conditions - - \-\-a-community : specify the community operation of the route that match to the conditions - - \-\-a-med : specify the med operation of the route that match to the conditions \ No newline at end of file +A RoutePolicy it is possible to have multiple statement, if you want to remove the RoutePolicy to specify only RoutePolicy name. +```shell +% gobgp policy routepolicy del policy1 +``` +If you want to remove one element(statement) of RoutePolicy, to specify a statement name in addition to the RoutePolicy name. +```shell +% gobgp policy prefix del policy1 state1 +``` + +#### - option +The following options can be specified in the policy subcommand: + - options of condition + +| short |long | description | +|--------|------------|--------------------------------------------------------------------| +|- |c-prefix |specify the name that added prefix set in PrefixSet subcommand | +|- |c-neighbor |specify the name that added neighbor set in NeighborSet subcommand | +|- |c-aspath |specify the name that added as path set in AsPathSet subcommand | +|- |c-community |pecify the name that added community set in CommunitySet subcommand | +|- |c-aslen |specify the operator(eq, ge, le) and value(numric) | +|- |c-option |specify the match option(any, all, invert) | + + - options of action + +| short |long | description | +|--------|------------|-----------------------------------------------------------------------------| +|- |a-route |specify the action(accept, reject) of the route that match to the conditions | +|- |a-community |specify the community operation of the route that match to the conditions | +|- |a-med |specify the med operation of the route that match to the conditions | + -- cgit v1.2.3