mirror of
https://github.com/osrg/gobgp.git
synced 2024-05-11 05:55:10 +00:00
api: add addpath support to AddPath API and cli
$gobgp global rib add 10.0.0.0/24 identifier 20 Signed-off-by: FUJITA Tomonori <[email protected]>
This commit is contained in:
@@ -651,6 +651,7 @@ func (s *Server) api2PathList(resource Resource, ApiPathList []*Path) ([]*table.
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nlri.SetPathIdentifier(path.Identifier)
|
||||
}
|
||||
|
||||
for _, attr := range path.Pattrs {
|
||||
|
||||
@@ -120,6 +120,7 @@ func (p *Path) ToNativePath(option ...ToNativeOption) (*table.Path, error) {
|
||||
}
|
||||
t := time.Unix(p.Age, 0)
|
||||
nlri.SetPathIdentifier(p.Identifier)
|
||||
nlri.SetPathLocalIdentifier(p.LocalIdentifier)
|
||||
path := table.NewPath(info, nlri, p.IsWithdraw, pattr, t, false)
|
||||
path.SetValidation(&table.Validation{
|
||||
Status: config.IntToRpkiValidationResultTypeMap[int(p.Validation)],
|
||||
|
||||
+10
-1
@@ -713,7 +713,16 @@ func ParsePath(rf bgp.RouteFamily, args []string) (*table.Path, error) {
|
||||
nlri = bgp.NewIPv6AddrPrefix(uint8(ones), ip.String())
|
||||
}
|
||||
|
||||
extcomms = args[1:]
|
||||
if len(args) > 2 && args[1] == "identifier" {
|
||||
if id, err := strconv.Atoi(args[2]); err != nil {
|
||||
return nil, fmt.Errorf("invalid format")
|
||||
} else {
|
||||
nlri.SetPathIdentifier(uint32(id))
|
||||
}
|
||||
extcomms = args[3:]
|
||||
} else {
|
||||
extcomms = args[1:]
|
||||
}
|
||||
|
||||
case bgp.RF_IPv4_VPN, bgp.RF_IPv6_VPN:
|
||||
if len(args) < 5 || args[1] != "label" || args[3] != "rd" {
|
||||
|
||||
Reference in New Issue
Block a user