Hi,

I have tried the same scenario with gobgpd and gobgp and the result is same. I 
guess sending each of the l3vpn-ipv4-unicast route in a separate update is the 
default method although sending the ipv4-unicast routes is not same. Its packs 
routes in a single updates.



On 25 Apr 2018, at 15:02, Deniz Aydın 
<deniz.ay...@turknet.net.tr<mailto:deniz.ay...@turknet.net.tr>> wrote:

Hi Iwase,

I have tried to send multiple routes for with the same rd and same attributes. 
But its sends the update in multiple bgp updates. I expect to group prefixes 
with the same RD and attributes (RT, local pref etc) in a single bgp updates. 
Is this the supposed behaviour?

mpls := bgp.NewMPLSLabelStack(100)
rd := bgp.NewRouteDistinguisherTwoOctetAS(1,1)
ecommunities := []bgp.ExtendedCommunityInterface{
bgp.NewTwoOctetAsSpecificExtended(bgp.EC_SUBTYPE_ROUTE_TARGET, 1, 1, true),
}
nlri1 := bgp.NewLabeledVPNIPAddrPrefix(32, "11.0.0.1", *mpls, rd)

mplsattrs1 := []bgp.PathAttributeInterface{
bgp.NewPathAttributeOrigin(0),
bgp.NewPathAttributeExtendedCommunities(ecommunities),
bgp.NewPathAttributeMpReachNLRI("192.168.1.1", 
[]bgp.AddrPrefixInterface{nlri1}),
}
     nlri2 := bgp.NewLabeledVPNIPAddrPrefix(32, "11.0.0.2", *mpls, rd)

mplsattrs2 := []bgp.PathAttributeInterface{
bgp.NewPathAttributeOrigin(0),
bgp.NewPathAttributeExtendedCommunities(ecommunities),
bgp.NewPathAttributeMpReachNLRI("192.168.1.1", 
[]bgp.AddrPrefixInterface{nlri2}),
}
//send the update
if _, err := s.AddPath("", []*table.Path{table.NewPath(nil, nlri1, false, 
mplsattrs1, time.Now(), false),table.NewPath(nil, nlri2, false, mplsattrs2, 
time.Now(), false)}); err != nil {
log.Fatal(err)
}


DEBU[0025] sent update                                   Key=10.2.51.7 
State=BGP_FSM_ESTABLISHED Topic=Peer attributes="[{Origin: i}  {LocalPref: 100} 
{MpReach(l3vpn-ipv4-unicast): {Nexthop: 192.168.1.1, NLRIs: [1:1:11.0.0.1/32]}} 
{Extcomms: [1:1]}]" nlri="[]" withdrawals="[]"
DEBU[0025] sent update                                   Key=10.2.51.7 
State=BGP_FSM_ESTABLISHED Topic=Peer attributes="[{Origin: i}  {LocalPref: 100} 
{MpReach(l3vpn-ipv4-unicast): {Nexthop: 192.168.1.1, NLRIs: [1:1:11.0.0.2/32]}} 
{Extcomms: [1:1]}]" nlri="[]" withdrawals="[]”



This the update from the router, multiple prefixes in a single update.

DEBU[0030] received update                               Key=10.2.51.7 
Topic=Peer attributes="[{MpReach(l3vpn-ipv4-unicast): {Nexthop: 10.2.51.7, 
NLRIs: [1:1:1.1.1.3/32 1:1:1.1.1.2/32 1:1:1.1.1.1/32]}} {Origin: ?}  {Med: 0} 
{LocalPref: 100} {Extcomms: [1:1]}]" nlri="[]" withdrawals="[]"



On 25 Apr 2018, at 11:09, Deniz Aydin 
<deniz.ay...@turknet.net.tr<mailto:deniz.ay...@turknet.net.tr>> wrote:

Hi Iwase,

Sorry for late update. It was holiday in here :). And also thanks for the 
sample code. I was lost in AddPath function in the server.go. Tried to use in 
the native way but it seems it only has subfunction for EVPNNLRI’es. And then 
no time dig more. Again great thanks for help. It save me lots of time. Also 
Thanks Dale for the reply.

I have added router-target extended community to the code you have send. 
gobgp<https://github.com/osrg/gobgp/tree/3645e7dee68faff9bd4fbadbb47dc89ecd06058a>/packet<https://github.com/osrg/gobgp/tree/3645e7dee68faff9bd4fbadbb47dc89ecd06058a/packet>/bgp<https://github.com/osrg/gobgp/tree/3645e7dee68faff9bd4fbadbb47dc89ecd06058a/packet/bgp>/helper.go
 helped me lot.


ecommunities := []bgp.ExtendedCommunityInterface{
bgp.NewTwoOctetAsSpecificExtended(bgp.EC_SUBTYPE_ROUTE_TARGET, 1, 1, true),
}


nlri := bgp.NewLabeledVPNIPAddrPrefix(32, "10.0.0.1", *mpls, rd)
attrs := []bgp.PathAttributeInterface{
bgp.NewPathAttributeOrigin(0),
bgp.NewPathAttributeExtendedCommunities(ecommunities),
bgp.NewPathAttributeMpReachNLRI("192.168.1.1", []bgp.AddrPrefixInterface{nlri}),
}

if _, err := s.AddPath("", []*table.Path{table.NewPath(nil, nlri, false, 
mplsattrs, time.Now(), false)}); err != nil {
log.Fatal(err)
}


Thanks,
Deniz



On 23 Apr 2018, at 04:41, Iwase Yusuke 
<iwase.yusu...@gmail.com<mailto:iwase.yusu...@gmail.com>> wrote:

Hi Deniz and Thanks Dale!

"gobgp/cmd/global.go" does similar, but it might be too complex.
https://github.com/osrg/gobgp/blob/master/gobgp/cmd/global.go#L1147-L1177

The following snippet helps for you?


mpls := bgp.NewMPLSLabelStack(100)

rd := bgp.NewRouteDistinguisherTwoOctetAS(65000, 100)
// Or, if you prefer to get RD from string;
// rd, err := bgp.ParseRouteDistinguisher("65000:100")
// if err != nil {
// return nil, err
// }

nlri := bgp.NewLabeledVPNIPAddrPrefix(24, "10.0.0.0", *mpls, rd)

attrs := []bgp.PathAttributeInterface{
bgp.NewPathAttributeOrigin(0),
bgp.NewPathAttributeAsPath([]bgp.AsPathParamInterface{
bgp.NewAs4PathParam(bgp.BGP_ASPATH_ATTR_TYPE_SEQ, []uint32{65002, 65001}),
}),
bgp.NewPathAttributeMpReachNLRI("192.168.1.1", []bgp.AddrPrefixInterface{nlri}),
}

path := table.NewPath(nil, nlri, false, attrs, time.Now(), false)


Thanks,
Iwase


On 2018年04月21日 05:49, Dale Worley wrote:
On 4/20/18 9:05 AM, Deniz Aydın wrote:
I am tring to use gobgp for just announcing l3vpn-ipv4-unicast routes
stored in database, some blackhole routes for different user profiles.
Can you give me an example how can I add some l3mpls vpn path like the
one in the /GoBGP as a Go Native BGP library./
I can give you some pointers:  It looks like the GoBGP constructors for route 
objects closely parallel the structure of routes inside BGP.  So look at 
https://tools.ietf.org/html/rfc3107#page-3 for how MPLS labels are attached to 
prefixes, and https://tools.ietf.org/html/rfc4364#section-4.2 for how route 
distinguishers are used.
I see in 
github.com/osrg/gobgp/packet/bgp/bgp.go<http://github.com/osrg/gobgp/packet/bgp/bgp.go>
 constructors like func NewLabeledVPNIPAddrPrefix and a lot of lines containing 
"MPLS".
Dale
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org<http://slashdot.org/>! 
http://sdm.link/slashdot
_______________________________________________
gobgp-devel mailing list
gobgp-devel@lists.sourceforge.net<mailto:gobgp-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/gobgp-devel




[TurkNet]<https://turk.net/>
________________________________
Bu elektronik posta ve onunla iletilen bütün dosyalar sadece göndericisi 
tarafından alması amaçlanan yetkili gerçek ya da tüzel kişinin kullanımı 
içindir. Eğer söz konusu yetkili alıcı değilseniz bu elektronik postanın 
içeriğini açıklamanız, kopyalamanız, yönlendirmeniz ve kullanmanız kesinlikle 
yasaktır ve bu elektronik postayı derhal silmeniz gerekmektedir. TurkNet bu 
mesajın içerdiği bilgilerin doğruluğu veya eksiksiz olduğu konusunda herhangi 
bir garanti vermemektedir. Bu nedenle bu bilgilerin ne şekilde olursa olsun 
içeriğinden, iletilmesinden, alınmasından ve saklanmasından sorumlu değildir. 
Bu mesajdaki görüşler yalnızca gönderen kişiye aittir ve TurkNet'in görüşlerini 
yansıtmayabilir. Bu e-posta bilinen bütün bilgisayar virüslerine karşı 
taranmıştır.
________________________________________
This e-mail and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you are not the intended recipient you are hereby notified that any 
dissemination, forwarding, copying or use of any of the information is strictly 
prohibited, and the e-mail should immediately be deleted. TurkNet makes no 
warranty as to the accuracy or completeness of any information contained in 
this message and hereby excludes any liability of any kind for the information 
contained therein or for the information transmission, reception, storage or 
use of such in any way whatsoever. The opinions expressed in this message 
belong to sender alone and may not necessarily reflect the opinions of TurkNet. 
This e-mail has been scanned for all known computer viruses.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
gobgp-devel mailing list
gobgp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gobgp-devel

Reply via email to