diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-04-25 10:06:56 +0000 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-04-25 15:16:45 +0000 |
commit | 99cccf981227a482cbd6404b664bd4f7cc9a1720 (patch) | |
tree | e8c93e477bb245122e4771cfe879db6833bcc04e /api | |
parent | 27d0d45b6319658bc0a43511d1909a411df40b08 (diff) |
table: add support for encapsulation nlri
add encap end point route(10.0.0.1) with vni 20
$ gobgp global rib add 10.0.0.1 20 -a encap
check it
$ gobgp global rib -a encap
Please specify one command of: add or del
Network Next Hop AS_PATH Age Attrs
*> 10.0.0.1 0.0.0.0 [64512] 00:00:01 [{Origin: IGP} {Encap: < VXLAN | color: 20 >}]
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'api')
-rw-r--r-- | api/gobgp.pb.go | 38 | ||||
-rw-r--r-- | api/gobgp.proto | 14 | ||||
-rw-r--r-- | api/util.go | 1 |
3 files changed, 50 insertions, 3 deletions
diff --git a/api/gobgp.pb.go b/api/gobgp.pb.go index 0e2874dd..4fb2413a 100644 --- a/api/gobgp.pb.go +++ b/api/gobgp.pb.go @@ -101,6 +101,7 @@ const ( SAFI_UNICAST SAFI = 1 SAFI_MULTICAST SAFI = 2 SAFI_MPLS_LABEL SAFI = 4 + SAFI_ENCAP SAFI = 7 SAFI_VPLS SAFI = 65 SAFI_EVPN SAFI = 70 SAFI_MPLS_VPN SAFI = 128 @@ -113,6 +114,7 @@ var SAFI_name = map[int32]string{ 1: "UNICAST", 2: "MULTICAST", 4: "MPLS_LABEL", + 7: "ENCAP", 65: "VPLS", 70: "EVPN", 128: "MPLS_VPN", @@ -124,6 +126,7 @@ var SAFI_value = map[string]int32{ "UNICAST": 1, "MULTICAST": 2, "MPLS_LABEL": 4, + "ENCAP": 7, "VPLS": 65, "EVPN": 70, "MPLS_VPN": 128, @@ -228,6 +231,32 @@ func (x EVPN_TYPE) String() string { return proto.EnumName(EVPN_TYPE_name, int32(x)) } +type ENCAP_SUBTLV_TYPE int32 + +const ( + ENCAP_SUBTLV_TYPE_UNKNOWN_SUBTLV_TYPE ENCAP_SUBTLV_TYPE = 0 + ENCAP_SUBTLV_TYPE_ENCAPSULATION ENCAP_SUBTLV_TYPE = 1 + ENCAP_SUBTLV_TYPE_PROTOCOL ENCAP_SUBTLV_TYPE = 2 + ENCAP_SUBTLV_TYPE_COLOR ENCAP_SUBTLV_TYPE = 4 +) + +var ENCAP_SUBTLV_TYPE_name = map[int32]string{ + 0: "UNKNOWN_SUBTLV_TYPE", + 1: "ENCAPSULATION", + 2: "PROTOCOL", + 4: "COLOR", +} +var ENCAP_SUBTLV_TYPE_value = map[string]int32{ + "UNKNOWN_SUBTLV_TYPE": 0, + "ENCAPSULATION": 1, + "PROTOCOL": 2, + "COLOR": 4, +} + +func (x ENCAP_SUBTLV_TYPE) String() string { + return proto.EnumName(ENCAP_SUBTLV_TYPE_name, int32(x)) +} + type BGP_ATTR_TYPE int32 const ( @@ -431,8 +460,12 @@ func (m *Nlri) GetEvpnNlri() *EVPNNlri { } type TunnelEncapSubTLV struct { - Type uint32 `protobuf:"varint,1,opt,name=type" json:"type,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + Type ENCAP_SUBTLV_TYPE `protobuf:"varint,1,opt,name=type,enum=api.ENCAP_SUBTLV_TYPE" json:"type,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + Key uint32 `protobuf:"varint,3,opt,name=key" json:"key,omitempty"` + Cookie string `protobuf:"bytes,4,opt,name=cookie" json:"cookie,omitempty"` + Protocol uint32 `protobuf:"varint,5,opt,name=protocol" json:"protocol,omitempty"` + Color uint32 `protobuf:"varint,6,opt,name=color" json:"color,omitempty"` } func (m *TunnelEncapSubTLV) Reset() { *m = TunnelEncapSubTLV{} } @@ -616,6 +649,7 @@ func init() { proto.RegisterEnum("api.Origin", Origin_name, Origin_value) proto.RegisterEnum("api.TUNNEL_TYPE", TUNNEL_TYPE_name, TUNNEL_TYPE_value) proto.RegisterEnum("api.EVPN_TYPE", EVPN_TYPE_name, EVPN_TYPE_value) + proto.RegisterEnum("api.ENCAP_SUBTLV_TYPE", ENCAP_SUBTLV_TYPE_name, ENCAP_SUBTLV_TYPE_value) proto.RegisterEnum("api.BGP_ATTR_TYPE", BGP_ATTR_TYPE_name, BGP_ATTR_TYPE_value) proto.RegisterEnum("api.Error_ErrorCode", Error_ErrorCode_name, Error_ErrorCode_value) } diff --git a/api/gobgp.proto b/api/gobgp.proto index 81b32ffb..611f1abc 100644 --- a/api/gobgp.proto +++ b/api/gobgp.proto @@ -73,6 +73,7 @@ enum SAFI { UNICAST = 1; MULTICAST = 2; MPLS_LABEL = 4; + ENCAP = 7; VPLS = 65; EVPN = 70; MPLS_VPN = 128; @@ -142,9 +143,20 @@ message Nlri { string nexthop = 4; } +enum ENCAP_SUBTLV_TYPE { + UNKNOWN_SUBTLV_TYPE = 0; + ENCAPSULATION = 1; + PROTOCOL = 2; + COLOR = 4; +} + message TunnelEncapSubTLV { - uint32 type = 1; + ENCAP_SUBTLV_TYPE type = 1; string value = 2; + uint32 key = 3; + string cookie = 4; + uint32 protocol = 5; + uint32 color = 6; } message TunnelEncapTLV { diff --git a/api/util.go b/api/util.go index aa27e3d3..00a4366c 100644 --- a/api/util.go +++ b/api/util.go @@ -18,6 +18,7 @@ package api var AF_IPV4_UC *AddressFamily = &AddressFamily{AFI_IP, SAFI_UNICAST} var AF_IPV6_UC *AddressFamily = &AddressFamily{AFI_IP6, SAFI_UNICAST} var AF_EVPN *AddressFamily = &AddressFamily{AFI_L2VPN, SAFI_EVPN} +var AF_ENCAP *AddressFamily = &AddressFamily{AFI_IP, SAFI_ENCAP} func (lhs *AddressFamily) Equal(rhs *AddressFamily) bool { return lhs.Afi == rhs.Afi && lhs.Safi == rhs.Safi |