diff --git a/cmd/gobgp/neighbor.go b/cmd/gobgp/neighbor.go index 05e95e731..26d798e96 100644 --- a/cmd/gobgp/neighbor.go +++ b/cmd/gobgp/neighbor.go @@ -1185,6 +1185,7 @@ func modNeighbor(cmdType string, args []string) error { } if cmdType == cmdAdd || cmdType == cmdUpdate { params["as"] = paramSingle + params["local-as"] = paramSingle params["family"] = paramSingle params["vrf"] = paramSingle params["route-reflector-client"] = paramSingle @@ -1193,7 +1194,7 @@ func modNeighbor(cmdType string, args []string) error { params["remove-private-as"] = paramSingle params["replace-peer-as"] = paramFlag params["ebgp-multihop-ttl"] = paramSingle - usage += " [ family | vrf | route-reflector-client [] | route-server-client | allow-own-as | remove-private-as (all|replace) | replace-peer-as | ebgp-multihop-ttl ]" + usage += " [ local-as | family | vrf | route-reflector-client [] | route-server-client | allow-own-as | remove-private-as (all|replace) | replace-peer-as | ebgp-multihop-ttl ]" } m, err := extractReserved(args, params) @@ -1255,6 +1256,13 @@ func modNeighbor(cmdType string, args []string) error { } peer.Conf.PeerAsn = uint32(as) } + if len(m["local-as"]) > 0 { + as, err := strconv.ParseUint(m["local-as"][0], 10, 32) + if err != nil { + return err + } + peer.Conf.LocalAsn = uint32(as) + } if len(m["family"]) == 1 { peer.AfiSafis = make([]*api.AfiSafi, 0) // for the case of cmdUpdate for _, f := range strings.Split(m["family"][0], ",") { diff --git a/docs/sources/cli-command-syntax.md b/docs/sources/cli-command-syntax.md index d682525af..695e227ab 100644 --- a/docs/sources/cli-command-syntax.md +++ b/docs/sources/cli-command-syntax.md @@ -126,7 +126,7 @@ Also, refer to the following for the detail syntax of each address family. ```shell # add neighbor -% gobgp neighbor add { | interface } as [ vrf | route-reflector-client [] | route-server-client | allow-own-as | remove-private-as (all|replace) | replace-peer-as | ebgp-multihop-ttl ] +% gobgp neighbor add { | interface } as [ local-as | vrf | route-reflector-client [] | route-server-client | allow-own-as | remove-private-as (all|replace) | replace-peer-as | ebgp-multihop-ttl ] # delete neighbor % gobgp neighbor del { | interface } % gobgp neighbor softreset [-a
]