Skip to content

Commit

Permalink
make the usage of type name in protobuf consistent
Browse files Browse the repository at this point in the history
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
  • Loading branch information
fujita committed Dec 23, 2018
1 parent ababf30 commit 8d0a8b0
Show file tree
Hide file tree
Showing 14 changed files with 815 additions and 815 deletions.
1,136 changes: 568 additions & 568 deletions api/gobgp.pb.go

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions api/gobgp.proto
Expand Up @@ -200,7 +200,7 @@ message AddDynamicNeighborRequest {
}

message AddPathRequest {
Resource resource = 1;
TableType table_type = 1;
string vrf_id = 2;
Path path = 3;
}
Expand All @@ -210,15 +210,15 @@ message AddPathResponse {
}

message DeletePathRequest {
Resource resource = 1;
TableType table_type = 1;
string vrf_id = 2;
Family family = 3;
Path path = 4;
bytes uuid = 5;
}

message ListPathRequest {
Resource type = 1;
TableType table_type = 1;
string name = 2;
Family family = 3;
repeated TableLookupPrefix prefixes = 4;
Expand All @@ -234,13 +234,13 @@ message ListPathResponse {
}

message AddPathStreamRequest {
Resource resource = 1;
TableType table_type = 1;
string vrf_id = 2;
repeated Path paths = 3;
}

message GetTableRequest {
Resource type = 1;
TableType table_type = 1;
Family family = 2;
string name = 3;
}
Expand All @@ -252,7 +252,7 @@ message GetTableResponse {
}

message MonitorTableRequest {
Resource type = 1;
TableType table_type = 1;
string name = 2;
Family family = 3;
bool current = 4;
Expand Down Expand Up @@ -318,7 +318,7 @@ message DeleteDefinedSetRequest {
}

message ListDefinedSetRequest {
DefinedType type = 1;
DefinedType defined_type = 1;
string name = 2;
}

Expand Down Expand Up @@ -436,7 +436,7 @@ message AddBmpRequest {
LOCAL = 3;
ALL = 4;
}
MonitoringPolicy type = 3;
MonitoringPolicy policy = 3;
int32 StatisticsTimeout = 4;
}

Expand Down Expand Up @@ -474,7 +474,7 @@ message Family {
Safi safi = 2;
}

enum Resource {
enum TableType {
GLOBAL = 0;
LOCAL = 1;
ADJ_IN = 2;
Expand Down Expand Up @@ -966,7 +966,7 @@ enum DefinedType {
}

message DefinedSet {
DefinedType type = 1;
DefinedType defined_type = 1;
string name = 2;
repeated string list = 3;
repeated Prefix prefixes = 4;
Expand All @@ -979,7 +979,7 @@ enum MatchType {
}

message MatchSet {
MatchType type = 1;
MatchType match_type = 1;
string name = 2;
}

Expand All @@ -990,7 +990,7 @@ enum AsPathLengthType {
}

message AsPathLength {
AsPathLengthType type = 1;
AsPathLengthType length_type = 1;
uint32 length = 2;
}

Expand Down Expand Up @@ -1027,7 +1027,7 @@ enum CommunityActionType {
}

message CommunityAction {
CommunityActionType type = 1;
CommunityActionType action_type = 1;
repeated string communities = 2;
}

Expand All @@ -1037,7 +1037,7 @@ enum MedActionType {
}

message MedAction {
MedActionType type = 1;
MedActionType action_type = 1;
int64 value = 2;
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/gobgp/bmp.go
Expand Up @@ -74,7 +74,7 @@ func modBmpServer(cmdType string, args []string) error {
_, err = client.AddBmp(ctx, &api.AddBmpRequest{
Address: address,
Port: port,
Type: policyType,
Policy: policyType,
StatisticsTimeout: int32(statisticsTimeout),
})
case cmdDel:
Expand Down
20 changes: 10 additions & 10 deletions cmd/gobgp/global.go
Expand Up @@ -1461,22 +1461,22 @@ usage: %s rib %s key <KEY> [value <VALUE>]`,
return err
}

r := api.Resource_GLOBAL
r := api.TableType_GLOBAL
if resource == cmdVRF {
r = api.Resource_VRF
r = api.TableType_VRF
}

if modtype == cmdAdd {
_, err = client.AddPath(ctx, &api.AddPathRequest{
Resource: r,
VrfId: name,
Path: path,
TableType: r,
VrfId: name,
Path: path,
})
} else {
_, err = client.DeletePath(ctx, &api.DeletePathRequest{
Resource: r,
VrfId: name,
Path: path,
TableType: r,
VrfId: name,
Path: path,
})
}
return err
Expand Down Expand Up @@ -1595,8 +1595,8 @@ func newGlobalCmd() *cobra.Command {
exitWithError(err)
}
if _, err = client.DeletePath(ctx, &api.DeletePathRequest{
Resource: api.Resource_GLOBAL,
Family: family,
TableType: api.TableType_GLOBAL,
Family: family,
}); err != nil {
exitWithError(err)
}
Expand Down
14 changes: 7 additions & 7 deletions cmd/gobgp/monitor.go
Expand Up @@ -122,9 +122,9 @@ func newMonitorCmd() *cobra.Command {
exitWithError(err)
}
recver, err := client.MonitorTable(ctx, &api.MonitorTableRequest{
Type: api.Resource_GLOBAL,
Family: family,
Current: current,
TableType: api.TableType_GLOBAL,
Family: family,
Current: current,
})
if err != nil {
exitWithError(err)
Expand Down Expand Up @@ -192,10 +192,10 @@ func newMonitorCmd() *cobra.Command {
exitWithError(err)
}
recver, err := client.MonitorTable(ctx, &api.MonitorTableRequest{
Type: api.Resource_ADJ_IN,
Name: name,
Family: family,
Current: current,
TableType: api.TableType_ADJ_IN,
Name: name,
Family: family,
Current: current,
})
if err != nil {
exitWithError(err)
Expand Down
4 changes: 2 additions & 2 deletions cmd/gobgp/mrt.go
Expand Up @@ -178,8 +178,8 @@ func injectMrt() error {

for paths := range ch {
err = stream.Send(&api.AddPathStreamRequest{
Resource: api.Resource_GLOBAL,
Paths: paths,
TableType: api.TableType_GLOBAL,
Paths: paths,
})
if err != nil {
return fmt.Errorf("failed to send: %s", err)
Expand Down
38 changes: 19 additions & 19 deletions cmd/gobgp/neighbor.go
Expand Up @@ -732,23 +732,23 @@ func showRibInfo(r, name string) error {
return err
}

var t api.Resource
var t api.TableType
switch r {
case cmdGlobal:
t = api.Resource_GLOBAL
t = api.TableType_GLOBAL
case cmdLocal:
t = api.Resource_LOCAL
t = api.TableType_LOCAL
case cmdAdjIn:
t = api.Resource_ADJ_IN
t = api.TableType_ADJ_IN
case cmdAdjOut:
t = api.Resource_ADJ_OUT
t = api.TableType_ADJ_OUT
default:
return fmt.Errorf("invalid resource to show RIB info: %s", r)
}
rsp, err := client.GetTable(ctx, &api.GetTableRequest{
Type: t,
Family: family,
Name: name,
TableType: t,
Family: family,
Name: name,
})

if err != nil {
Expand Down Expand Up @@ -842,28 +842,28 @@ func showNeighborRib(r string, name string, args []string) error {
}
}

var t api.Resource
var t api.TableType
switch r {
case cmdGlobal:
t = api.Resource_GLOBAL
t = api.TableType_GLOBAL
case cmdLocal:
t = api.Resource_LOCAL
t = api.TableType_LOCAL
case cmdAdjIn, cmdAccepted, cmdRejected:
t = api.Resource_ADJ_IN
t = api.TableType_ADJ_IN
showIdentifier = bgp.BGP_ADD_PATH_RECEIVE
case cmdAdjOut:
t = api.Resource_ADJ_OUT
t = api.TableType_ADJ_OUT
showIdentifier = bgp.BGP_ADD_PATH_SEND
case cmdVRF:
t = api.Resource_VRF
t = api.TableType_VRF
}

stream, err := client.ListPath(ctx, &api.ListPathRequest{
Type: t,
Family: family,
Name: name,
Prefixes: filter,
SortType: api.ListPathRequest_PREFIX,
TableType: t,
Family: family,
Name: name,
Prefixes: filter,
SortType: api.ListPathRequest_PREFIX,
})
if err != nil {
return err
Expand Down

0 comments on commit 8d0a8b0

Please sign in to comment.