diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/gobgp.pb.go | 105 | ||||
-rw-r--r-- | api/gobgp.proto | 37 | ||||
-rw-r--r-- | api/util.go | 1 |
3 files changed, 132 insertions, 11 deletions
diff --git a/api/gobgp.pb.go b/api/gobgp.pb.go index b0f2ed40..af9dde83 100644 --- a/api/gobgp.pb.go +++ b/api/gobgp.pb.go @@ -14,8 +14,10 @@ It has these top-level messages: ModPathArguments AddressFamily Aggregator + ExtendedCommunity EVPNNlri EvpnMacIpAdvertisement + RTNlri Nlri TunnelEncapSubTLV TunnelEncapTLV @@ -106,7 +108,7 @@ const ( SAFI_EVPN SAFI = 70 SAFI_MPLS_VPN SAFI = 128 SAFI_MPLS_VPN_MULTICAST SAFI = 129 - SAFI_ROUTE_TARGET_CONSTRTAINS SAFI = 132 + SAFI_ROUTE_TARGET_CONSTRAINTS SAFI = 132 ) var SAFI_name = map[int32]string{ @@ -119,7 +121,7 @@ var SAFI_name = map[int32]string{ 70: "EVPN", 128: "MPLS_VPN", 129: "MPLS_VPN_MULTICAST", - 132: "ROUTE_TARGET_CONSTRTAINS", + 132: "ROUTE_TARGET_CONSTRAINTS", } var SAFI_value = map[string]int32{ "UNKNOWN_SAFI": 0, @@ -131,7 +133,7 @@ var SAFI_value = map[string]int32{ "EVPN": 70, "MPLS_VPN": 128, "MPLS_VPN_MULTICAST": 129, - "ROUTE_TARGET_CONSTRTAINS": 132, + "ROUTE_TARGET_CONSTRAINTS": 132, } func (x SAFI) String() string { @@ -161,6 +163,55 @@ func (x Origin) String() string { return proto.EnumName(Origin_name, int32(x)) } +type EXTENDED_COMMUNITIE_TYPE int32 + +const ( + EXTENDED_COMMUNITIE_TYPE_TWO_OCTET_AS_SPECIFIC EXTENDED_COMMUNITIE_TYPE = 0 + EXTENDED_COMMUNITIE_TYPE_IP4_SPECIFIC EXTENDED_COMMUNITIE_TYPE = 1 + EXTENDED_COMMUNITIE_TYPE_FOUR_OCTET_AS_SPECIFIC EXTENDED_COMMUNITIE_TYPE = 2 + EXTENDED_COMMUNITIE_TYPE_OPAQUE EXTENDED_COMMUNITIE_TYPE = 3 +) + +var EXTENDED_COMMUNITIE_TYPE_name = map[int32]string{ + 0: "TWO_OCTET_AS_SPECIFIC", + 1: "IP4_SPECIFIC", + 2: "FOUR_OCTET_AS_SPECIFIC", + 3: "OPAQUE", +} +var EXTENDED_COMMUNITIE_TYPE_value = map[string]int32{ + "TWO_OCTET_AS_SPECIFIC": 0, + "IP4_SPECIFIC": 1, + "FOUR_OCTET_AS_SPECIFIC": 2, + "OPAQUE": 3, +} + +func (x EXTENDED_COMMUNITIE_TYPE) String() string { + return proto.EnumName(EXTENDED_COMMUNITIE_TYPE_name, int32(x)) +} + +type EXTENDED_COMMUNITIE_SUBTYPE int32 + +const ( + EXTENDED_COMMUNITIE_SUBTYPE_ORIGIN_VALIDATION EXTENDED_COMMUNITIE_SUBTYPE = 0 + EXTENDED_COMMUNITIE_SUBTYPE_ROUTE_TARGET EXTENDED_COMMUNITIE_SUBTYPE = 2 + EXTENDED_COMMUNITIE_SUBTYPE_ROUTE_ORIGIN EXTENDED_COMMUNITIE_SUBTYPE = 3 +) + +var EXTENDED_COMMUNITIE_SUBTYPE_name = map[int32]string{ + 0: "ORIGIN_VALIDATION", + 2: "ROUTE_TARGET", + 3: "ROUTE_ORIGIN", +} +var EXTENDED_COMMUNITIE_SUBTYPE_value = map[string]int32{ + "ORIGIN_VALIDATION": 0, + "ROUTE_TARGET": 2, + "ROUTE_ORIGIN": 3, +} + +func (x EXTENDED_COMMUNITIE_SUBTYPE) String() string { + return proto.EnumName(EXTENDED_COMMUNITIE_SUBTYPE_name, int32(x)) +} + type TUNNEL_TYPE int32 const ( @@ -402,6 +453,19 @@ func (m *Aggregator) Reset() { *m = Aggregator{} } func (m *Aggregator) String() string { return proto.CompactTextString(m) } func (*Aggregator) ProtoMessage() {} +type ExtendedCommunity struct { + Type EXTENDED_COMMUNITIE_TYPE `protobuf:"varint,1,opt,name=type,enum=api.EXTENDED_COMMUNITIE_TYPE" json:"type,omitempty"` + Subtype EXTENDED_COMMUNITIE_SUBTYPE `protobuf:"varint,2,opt,name=subtype,enum=api.EXTENDED_COMMUNITIE_SUBTYPE" json:"subtype,omitempty"` + IsTransitive bool `protobuf:"varint,3,opt,name=is_transitive" json:"is_transitive,omitempty"` + Asn uint32 `protobuf:"varint,4,opt,name=asn" json:"asn,omitempty"` + Ipv4 string `protobuf:"bytes,5,opt,name=ipv4" json:"ipv4,omitempty"` + LocalAdmin uint32 `protobuf:"varint,6,opt,name=local_admin" json:"local_admin,omitempty"` +} + +func (m *ExtendedCommunity) Reset() { *m = ExtendedCommunity{} } +func (m *ExtendedCommunity) String() string { return proto.CompactTextString(m) } +func (*ExtendedCommunity) ProtoMessage() {} + type EVPNNlri struct { Type EVPN_TYPE `protobuf:"varint,1,opt,name=type,enum=api.EVPN_TYPE" json:"type,omitempty"` // EvpnAutoDiscoveryRoute = 2; @@ -434,11 +498,29 @@ func (m *EvpnMacIpAdvertisement) Reset() { *m = EvpnMacIpAdvertisement{} func (m *EvpnMacIpAdvertisement) String() string { return proto.CompactTextString(m) } func (*EvpnMacIpAdvertisement) ProtoMessage() {} +type RTNlri struct { + Asn uint32 `protobuf:"varint,1,opt,name=asn" json:"asn,omitempty"` + Target *ExtendedCommunity `protobuf:"bytes,2,opt,name=target" json:"target,omitempty"` + Length uint32 `protobuf:"varint,3,opt,name=length" json:"length,omitempty"` +} + +func (m *RTNlri) Reset() { *m = RTNlri{} } +func (m *RTNlri) String() string { return proto.CompactTextString(m) } +func (*RTNlri) ProtoMessage() {} + +func (m *RTNlri) GetTarget() *ExtendedCommunity { + if m != nil { + return m.Target + } + return nil +} + type Nlri struct { Af *AddressFamily `protobuf:"bytes,1,opt,name=af" json:"af,omitempty"` Prefix string `protobuf:"bytes,2,opt,name=prefix" json:"prefix,omitempty"` - EvpnNlri *EVPNNlri `protobuf:"bytes,3,opt,name=evpn_nlri" json:"evpn_nlri,omitempty"` - Nexthop string `protobuf:"bytes,4,opt,name=nexthop" json:"nexthop,omitempty"` + Nexthop string `protobuf:"bytes,3,opt,name=nexthop" json:"nexthop,omitempty"` + EvpnNlri *EVPNNlri `protobuf:"bytes,4,opt,name=evpn_nlri" json:"evpn_nlri,omitempty"` + RtNlri *RTNlri `protobuf:"bytes,5,opt,name=rt_nlri" json:"rt_nlri,omitempty"` } func (m *Nlri) Reset() { *m = Nlri{} } @@ -459,6 +541,13 @@ func (m *Nlri) GetEvpnNlri() *EVPNNlri { return nil } +func (m *Nlri) GetRtNlri() *RTNlri { + if m != nil { + return m.RtNlri + } + return nil +} + type TunnelEncapSubTLV struct { 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"` @@ -500,7 +589,7 @@ type PathAttr struct { Communites []uint32 `protobuf:"varint,9,rep,name=communites" json:"communites,omitempty"` Originator string `protobuf:"bytes,10,opt,name=originator" json:"originator,omitempty"` Cluster []string `protobuf:"bytes,11,rep,name=cluster" json:"cluster,omitempty"` - Nlri *Nlri `protobuf:"bytes,12,opt,name=nlri" json:"nlri,omitempty"` + Nlri []*Nlri `protobuf:"bytes,12,rep,name=nlri" json:"nlri,omitempty"` TunnelEncap []*TunnelEncapTLV `protobuf:"bytes,13,rep,name=tunnel_encap" json:"tunnel_encap,omitempty"` } @@ -515,7 +604,7 @@ func (m *PathAttr) GetAggregator() *Aggregator { return nil } -func (m *PathAttr) GetNlri() *Nlri { +func (m *PathAttr) GetNlri() []*Nlri { if m != nil { return m.Nlri } @@ -647,6 +736,8 @@ func init() { proto.RegisterEnum("api.AFI", AFI_name, AFI_value) proto.RegisterEnum("api.SAFI", SAFI_name, SAFI_value) proto.RegisterEnum("api.Origin", Origin_name, Origin_value) + proto.RegisterEnum("api.EXTENDED_COMMUNITIE_TYPE", EXTENDED_COMMUNITIE_TYPE_name, EXTENDED_COMMUNITIE_TYPE_value) + proto.RegisterEnum("api.EXTENDED_COMMUNITIE_SUBTYPE", EXTENDED_COMMUNITIE_SUBTYPE_name, EXTENDED_COMMUNITIE_SUBTYPE_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) diff --git a/api/gobgp.proto b/api/gobgp.proto index 611f1abc..7f12d27b 100644 --- a/api/gobgp.proto +++ b/api/gobgp.proto @@ -78,7 +78,7 @@ enum SAFI { EVPN = 70; MPLS_VPN = 128; MPLS_VPN_MULTICAST = 129; - ROUTE_TARGET_CONSTRTAINS = 132; + ROUTE_TARGET_CONSTRAINTS = 132; } message AddressFamily { @@ -97,6 +97,28 @@ message Aggregator { string address = 2; } +enum EXTENDED_COMMUNITIE_TYPE { + TWO_OCTET_AS_SPECIFIC = 0; + IP4_SPECIFIC = 1; + FOUR_OCTET_AS_SPECIFIC = 2; + OPAQUE = 3; +} + +enum EXTENDED_COMMUNITIE_SUBTYPE { + ORIGIN_VALIDATION = 0; + ROUTE_TARGET = 2; + ROUTE_ORIGIN = 3; +} + +message ExtendedCommunity { + EXTENDED_COMMUNITIE_TYPE type = 1; + EXTENDED_COMMUNITIE_SUBTYPE subtype = 2; + bool is_transitive = 3; + uint32 asn = 4; + string ipv4 = 5; + uint32 local_admin = 6; +} + enum TUNNEL_TYPE { UNKNOWN_TUNNEL_TYPE = 0; L2TPV3_OVER_IP = 1; @@ -136,11 +158,18 @@ message EvpnMacIpAdvertisement { repeated uint32 labels = 8; } +message RTNlri { + uint32 asn = 1; + ExtendedCommunity target = 2; + uint32 length = 3; +} + message Nlri { AddressFamily af = 1; string prefix = 2; - EVPNNlri evpn_nlri = 3; - string nexthop = 4; + string nexthop = 3; + EVPNNlri evpn_nlri = 4; + RTNlri rt_nlri = 5; } enum ENCAP_SUBTLV_TYPE { @@ -196,7 +225,7 @@ message PathAttr { repeated uint32 communites = 9; string originator = 10; repeated string cluster = 11; - Nlri nlri = 12; + repeated Nlri nlri = 12; repeated TunnelEncapTLV tunnel_encap = 13; } diff --git a/api/util.go b/api/util.go index 00a4366c..591c1c59 100644 --- a/api/util.go +++ b/api/util.go @@ -19,6 +19,7 @@ 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} +var AF_RTC *AddressFamily = &AddressFamily{AFI_IP, SAFI_ROUTE_TARGET_CONSTRAINTS} func (lhs *AddressFamily) Equal(rhs *AddressFamily) bool { return lhs.Afi == rhs.Afi && lhs.Safi == rhs.Safi |