diff options
author | Serguei Bezverkhi <sbezverk@cisco.com> | 2020-11-25 17:29:13 -0500 |
---|---|---|
committer | Serguei Bezverkhi <sbezverk@cisco.com> | 2020-11-25 17:29:13 -0500 |
commit | 48e55b7c388dd6912f4c7f39998723b4ab6159e3 (patch) | |
tree | 242bfba54e72ca8bc8cfbe0a77200b5b79e8c58e /internal | |
parent | 66413b5335790dc9110b80c8cffe31b3259df9d2 (diff) |
code changes
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
Diffstat (limited to 'internal')
-rw-r--r-- | internal/pkg/apiutil/attribute.go | 12 | ||||
-rw-r--r-- | internal/pkg/config/bgp_configs.go | 18 |
2 files changed, 24 insertions, 6 deletions
diff --git a/internal/pkg/apiutil/attribute.go b/internal/pkg/apiutil/attribute.go index 9d70802b..112df6ff 100644 --- a/internal/pkg/apiutil/attribute.go +++ b/internal/pkg/apiutil/attribute.go @@ -768,6 +768,13 @@ func UnmarshalNLRI(rf bgp.RouteFamily, an *any.Any) (bgp.AddrPrefixInterface, er } nlri = bgp.NewEVPNIPPrefixRoute(rd, *esi, v.EthernetTag, uint8(v.IpPrefixLen), v.IpPrefix, v.GwAddress, v.Label) } + case *api.SRPolicyNLRI: + switch rf { + case bgp.RF_SR_POLICY_IPv4: + nlri = bgp.NewSRPolicyIPv4(v.Length, v.Distinguisher, v.Color, v.Endpoint) + case bgp.RF_SR_POLICY_IPv6: + nlri = bgp.NewSRPolicyIPv6(v.Length, v.Distinguisher, v.Color, v.Endpoint) + } case *api.LabeledVPNIPAddressPrefix: rd, err := UnmarshalRD(v.Rd) if err != nil { @@ -1604,6 +1611,11 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) { subTlv = bgp.NewTunnelEncapSubTLVProtocol(uint16(sv.Protocol)) case *api.TunnelEncapSubTLVColor: subTlv = bgp.NewTunnelEncapSubTLVColor(sv.Color) + + // TODO (sbezverk) Add processing SR Policy Tunnel sub tlv + case *api.TunnelEncapSubTLVSRPreference: + subTlv = bgp.NewTunnelEncapSubTLVSRPreference(sv.Flags, sv.Preference) + case *api.TunnelEncapSubTLVUnknown: subTlv = bgp.NewTunnelEncapSubTLVUnknown(bgp.EncapSubTLVType(sv.Type), sv.Value) default: diff --git a/internal/pkg/config/bgp_configs.go b/internal/pkg/config/bgp_configs.go index b421a440..6d8fd26c 100644 --- a/internal/pkg/config/bgp_configs.go +++ b/internal/pkg/config/bgp_configs.go @@ -260,6 +260,8 @@ const ( AFI_SAFI_TYPE_IPV6_FLOWSPEC AfiSafiType = "ipv6-flowspec" AFI_SAFI_TYPE_L3VPN_IPV6_FLOWSPEC AfiSafiType = "l3vpn-ipv6-flowspec" AFI_SAFI_TYPE_L2VPN_FLOWSPEC AfiSafiType = "l2vpn-flowspec" + AFI_SAFI_TYPE_IPV4_SRPOLICY AfiSafiType = "ipv4-srpolicy" + AFI_SAFI_TYPE_IPV6_SRPOLICY AfiSafiType = "ipv6-srpolicy" AFI_SAFI_TYPE_OPAQUE AfiSafiType = "opaque" AFI_SAFI_TYPE_LS AfiSafiType = "ls" ) @@ -285,8 +287,10 @@ var AfiSafiTypeToIntMap = map[AfiSafiType]int{ AFI_SAFI_TYPE_IPV6_FLOWSPEC: 17, AFI_SAFI_TYPE_L3VPN_IPV6_FLOWSPEC: 18, AFI_SAFI_TYPE_L2VPN_FLOWSPEC: 19, - AFI_SAFI_TYPE_OPAQUE: 20, - AFI_SAFI_TYPE_LS: 21, + AFI_SAFI_TYPE_IPV4_SRPOLICY: 20, + AFI_SAFI_TYPE_IPV6_SRPOLICY: 21, + AFI_SAFI_TYPE_OPAQUE: 22, + AFI_SAFI_TYPE_LS: 23, } var IntToAfiSafiTypeMap = map[int]AfiSafiType{ @@ -310,8 +314,10 @@ var IntToAfiSafiTypeMap = map[int]AfiSafiType{ 17: AFI_SAFI_TYPE_IPV6_FLOWSPEC, 18: AFI_SAFI_TYPE_L3VPN_IPV6_FLOWSPEC, 19: AFI_SAFI_TYPE_L2VPN_FLOWSPEC, - 20: AFI_SAFI_TYPE_OPAQUE, - 21: AFI_SAFI_TYPE_LS, + 20: AFI_SAFI_TYPE_IPV4_SRPOLICY, + 21: AFI_SAFI_TYPE_IPV6_SRPOLICY, + 22: AFI_SAFI_TYPE_OPAQUE, + 23: AFI_SAFI_TYPE_LS, } func (v AfiSafiType) Validate() error { @@ -1135,7 +1141,7 @@ type ZebraState struct { MplsLabelRangeSize uint32 `mapstructure:"mpls-label-range-size" json:"mpls-label-range-size,omitempty"` // original -> gobgp:software-name // Configure zebra software name. - // quagga, frr3, frr4, frr5, frr6, frr7 can be used. + // frr4, cumulus, frr6, frr7, and frr7.2 can be used. SoftwareName string `mapstructure:"software-name" json:"software-name,omitempty"` } @@ -1165,7 +1171,7 @@ type ZebraConfig struct { MplsLabelRangeSize uint32 `mapstructure:"mpls-label-range-size" json:"mpls-label-range-size,omitempty"` // original -> gobgp:software-name // Configure zebra software name. - // quagga, frr3, frr4, frr5, frr6, frr7 can be used. + // frr4, cumulus, frr6, frr7, and frr7.2 can be used. SoftwareName string `mapstructure:"software-name" json:"software-name,omitempty"` } |