BGP advertise-map questions

I have a few questions pertaining to Conditional advertisements in BGP using advertise-map(s).
From the Cisco site the examples I have seen stipulate that the routes you redistribute into BGP are through the means of "network" statements.
The first question is, are you able to redistribute the route(s) you wish to control being advertised to neighboring BGP peers via an advertise-map through the "redistribute" command or must you use "network" statements?
The second question is, are you able to put a condition on more than one route that you may or may not want to advertise based on the condition you have set. In otherwords as an example I want to allow around 30 routes to be advertised towards a BGP peer if a certain route exists in the BGP routing table. For this I will obviously need to use an advertise-map with the exist-map statement. Is it possible to have this condition set on the 30 routes?

Advertise-map are only related to what is sent out of the router. They really don't care how the route got into the router. You can use either network statements or the redistribution command to get them into the bgp routing table.
I don't know what the limit is on how many addreses you can put in the route-map used for conditional advertisement but it is much more than 30. It would just be in worse case a access list that had 30 entries.
The conditional advertisement is not really any different than a normal route-map filter. You just build a access list or prefix list that matches any address you want to allow. You do it the same way as if you were building a normal route-map that allow certain routes all the time. The only thing really special is when it is applied not how you create it.

Similar Messages

  • BGP Outbound Route-Map Question

    Hi Experts,
    Just need your help again. I was trying to do some lab and I came across this weird behaviour with BGP outbound route-map. The diagram is simple.
    Please see attached diagram. Sorry for the very poor illustration. R6 has iBGP peering to both R4 and R1. Both R1 and R4 have eBGP peering to R5. No IGP running on any routers as well to keep things simple. There are 2 things to do.
    * Create a static route for 160.1.0.0/16 pointing to Null0 on both R1 and R4 and advertise to BGP via network statement but only R5 should be able to see the 160.1.0.0/16 route. R6 should not receive it.
    * Advertise R5's /32 loopback interface to BGP but ensure R6 to have that route in its routing table. Don't use next-hop-self on both R1 and R4. Don't advertise WAN link via network command.
    I'll just illustrate R4 and R6 here to keep things straight forward.
    R4#sh ip bgp
    BGP table version is 5, local router ID is 150.1.4.4
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
                  r RIB-failure, S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete
       Network          Next Hop            Metric LocPrf Weight Path
    *> 150.1.5.5/32     155.1.45.5               0             0 100 i
    *> 160.1.0.0        0.0.0.0                  0         32768 i
    R6#sh ip bgp
    BGP table version is 11, local router ID is 150.1.6.6
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
                  r RIB-failure, S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete
       Network          Next Hop            Metric LocPrf Weight Path
    * i150.1.5.5/32     155.1.45.5               0    100      0 100 i
    * i                 155.1.0.5                0    100      0 100 i
    The first task was achieved as the 160.0.0.0/16 route is not present in R6's table. I used these commands in R4.
    router bgp 65000
     no synchronization
     bgp log-neighbor-changes
     network 160.1.0.0
     neighbor 155.1.45.5 remote-as 100
     neighbor 155.1.146.6 remote-as 65000
     neighbor 155.1.146.6 route-map R6_OUT out
     no auto-summary
    route-map R6_OUT deny 5
     match ip address prefix-list AGGR
    route-map R6_OUT permit 1000
    ip prefix-list AGGR seq 5 permit 160.1.0.0/16
    So with the configuration above, it is clear that R4 is hitting route-map line 5 to deny 160.1.0.0/16 being advertised to R6. I tried to remove line 5 to validate as well if the /16 route will be advertised to R6 and it did so route-map configuration above is confirmed working.
    Next, advertise loopback 0 of R5 to R6 and make sure it is a valid route in BGP table without the use of next-hop-self or WAN advertisement.
    I used the following configuration.
    ip prefix-list R5_LINK seq 5 permit 155.1.45.5/32
    route-map R6_OUT permit 10
     match ip route-source R5_LINK
     set ip next-hop 155.1.146.4
    I inserted line 10 in between route-map 5 and 1000. So R4 would check its route table for routes with 155.1.45.5 as route-source then advertise it to R6 with next-hop address of 155.1.146.4. It worked!
    R6#sh ip bgp
    BGP table version is 15, local router ID is 150.1.6.6
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
                  r RIB-failure, S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete
       Network          Next Hop            Metric LocPrf Weight Path
    *>i150.1.5.5/32     155.1.146.4              0    100      0 100 i
    * i                 155.1.0.5                0    100      0 100 i
    *>i160.1.0.0        155.1.146.4              0    100      0 i
    As you can see above, 150.1.5.5 route is now a valid BGP route but surprisingly, the 160.1.0.0/16 route is there! From what I have seen, BGP skipped line 5 and started at 10. Even if I insert the same rule as line 5 and make it as line 15, it's not working. The /16 route is still being advertised. If I remove the match ip route-source clause in sequence 10 then it will withdraw the 160.1.0.0/16 route again. Looks like "match ip route-source" is not very friendly with direct filtering to BGP neighbors but I saw this being used with BGP inject-map and it worked well.
    R4#sh route-map
    route-map R6_OUT, deny, sequence 5
      Match clauses:
        ip address prefix-lists: AGGR
      Set clauses:
      Policy routing matches: 0 packets, 0 bytes
    route-map R6_OUT, permit, sequence 10
      Match clauses:
        ip route-source (access-lists): R5_LINK
      Set clauses:
        ip next-hop 155.1.146.4
      Policy routing matches: 0 packets, 0 bytes
    route-map R6_OUT, permit, sequence 1000
      Match clauses:
      Set clauses:
      Policy routing matches: 0 packets, 0 bytes
    Any thoughts why this is happening?
    Thanks in advance.

    Hi John,
    I did a small lab to test feature "match ip route-source" and it is working fine. Please check below config and output.
    R4 does not have 172.16.16.0/24 and also routes for which next-hop is not 1.1.1.1. In case you still facing issue, please share output of "debug ip bgp updates out"
    Topology
    R1--ebgp--R3---ibgp---R4
    R3#show ip b su | b Nei
    Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
    1.1.1.1         4          100      34      36       29    0    0 00:27:37        7
    4.4.4.4         4          300       9      12       29    0    0 00:04:12        0
    R3#
    R3#sh route-map TO-R4
    route-map TO-R4, deny, sequence 10
      Match clauses:
        ip address prefix-lists: DENY-PREFIX 
      Set clauses:
      Policy routing matches: 0 packets, 0 bytes
    route-map TO-R4, permit, sequence 20
      Match clauses:
        ip route-source (access-lists): 20 
      Set clauses:
      Policy routing matches: 0 packets, 0 bytes
    R3#
    R3#show ip prefix-list DENY-PREFIX
    ip prefix-list DENY-PREFIX: 1 entries
       seq 5 permit 172.16.16.0/24
    R3#
    R3#sh ip access-lists 20
    Standard IP access list 20
        20 permit 1.1.1.1 (25 matches)
    R3#
    R3#show ip b
    BGP table version is 29, local router ID is 3.3.3.3
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
                  r RIB-failure, S Stale, m multipath, b backup-path, x best-external
    Origin codes: i - IGP, e - EGP, ? - incomplete
       Network          Next Hop            Metric LocPrf Weight Path
    *  172.16.8.0/22    1.1.1.1                  0             0 100 i
    *>                  172.31.13.1             20         32768 i
    *> 172.16.16.0/24   1.1.1.1                  0             0 100 i
    *> 172.16.17.0/24   1.1.1.1                  0             0 100 i
    *> 172.16.19.0/24   1.1.1.1                  0             0 100 i
    *> 172.16.20.0/22   1.1.1.1                  0             0 100 i
    *  172.16.24.0/30   1.1.1.1                  0             0 100 i
    *>                  172.31.13.1             20         32768 i
    *> 172.16.80.0/22   1.1.1.1                  0             0 100 i
    R3#
    R4#show ip b
    BGP table version is 53, local router ID is 4.4.4.4
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
                  r RIB-failure, S Stale, m multipath, b backup-path, x best-external
    Origin codes: i - IGP, e - EGP, ? - incomplete
       Network          Next Hop            Metric LocPrf Weight Path
    r>i172.16.17.0/24   1.1.1.1                  0    100      0 100 i
    r>i172.16.19.0/24   1.1.1.1                  0    100      0 100 i
    r>i172.16.20.0/22   1.1.1.1                  0    100      0 100 i
    *>i172.16.80.0/22   1.1.1.1                  0    100      0 100 i
    R4#
    --Pls dont forget to rate helpful posts--
    Regards,
    Akash

  • Bgp inject-map

    I am confused about the use case of bgp inject-maps. If the goal is to inject specific prefixes, then why not just add an ip route <network> <next-hop> statement for more specific prefix (so that the specific prefix appears in routing table) and then add a network statement under router bgp so that the specific prefix appears in bgp table also? Could any expert help?
    I was reading about the feature at  https://blog.initialdraft.com/archives/3527/

    Kashish
    You could indeed just add more speciifc routes to the IP routing table and then configure "network ..." commands under BGP. But then because the route is always in the IP routing table it would always be advertising the more specific routes.
    The BGP inject-maps feature is also known as BGP conditional advertising ie. you may only want to advertise the more specific prefixes if you are actually receiving the less specific prefix from a neighbor. Because if you stop receiving that less specific prefix then you do not want traffic coming to your router as it will be dropped.
    So with BGP inject-maps you can say only advertise the more specific prefixes as long as the router is receiving the less specific prefix. If the less specific prefix is no longer received then do not advertise the more specific prefixes.
    You couldnt do this if you simply added routes to the routing table.
    Note i referred to less specific rather than summary route as it doesn't actually have to be a summary route ie. it could be a class C for example but you are advertiing out subnets within the class C.
    Jon

  • CRMXIF_REL_SAVE_M01 - Mapping Question

    Hello All,
    I have a mapping question, hope some one can answer my question. Please see the link first and the see my question
    http://www.flickr.com/photos/8764045@N06/4265246260/sizes/o/
    I'm mapping the CRM IDOC to the JDBC Call. I have small problem here. All the target fields are Mandatory 1..1 .
    I will explain with an example:
    I have field from source E102BUS_EI_STRUC_TEL_DATA/COUNTRY mapped to target field.
    I used Map With Default so that even if the values are not there frm the source the target field will be mapped with blank.
    But the problem is the parent node for E102BUS_EI_STRUC_TEL_DATA is E102BUS_EI_BUPA_TELEPHONE is 0.999999 , so sometimes that segment is not coming. In this case Map with Default won't work. Map with Default willl work only if the Parent node is present.
    If you ask me to do Exists node function on E102BUS_EI_BUPA_TELEPHONE and then apply Map with Default, then even this won't work.
    Apologize if I confused you guys. Please let me know if you need more clarification.
    Thanks!
    Raj.

    Hi Raj,
    Try to do a mapping like this
    E102BUS_EI_STRUC_TEL_DATA(context E102S_EI_BUPA_TELEPHONE_CON)--mapwithdefault-->then
    E102BUS_EI_BUPA_TELEPHONE-->exists------------------------------------------------------------------>if---->splitbyValue
    let us say this output (the output of splitbyvalue) as 'VALUE'
    VALUE-----------------------------------------------> then
    VALUE|-->count--->greater----------------------->if----->targetField                            
          Constant(0)---->              Constant(blank)-->else
    Regards
    Suraj

  • A top difficulty mapping question

    Hello
    dose anyone can give solution for this mapping question?
    soruce :
    <header>header</header>
    <item>
         <A>a1</A>
         <B>b1</B>
         <C>c1</C>
    </item>
    <item>
         <A>a2</A>
         <B>b2</B>
         <C>c2</C>
    </item>
    <item>
         <A>a3</A>
         <B>b3</B>
         <C>c3</C>
    </item>
    target:
    <header>header</header>
    <item>
         <A>a1,a2,a3  .....</A>
         <B>b1,b2,b3  .....</B>
         <C>c1,c2,c3  .....</C>
    </item>
    The numbers of item is not fixed,it is unbounded.
    so the target line length is not fixed at design time
    welcome any hits,
    Thanks !!
    BR,
    Jeffrey

    Hi,
    Use cache parameter as Context.
    public void add_element(String[] a,ResultList result,Container container)
      //write your code here
    String c = "";
    int i;
    for(i= 0 ; i < a.length; i++)
             c = c + a<i> ;
             if(i != (a.length-1))
                  c = c + ",";
    result.addValue(c);
    A(src)-->removecontext->UDF--->A(tgt)
    B(src)--->removecontext->UDF--->B(tgt)
    C(src)--->removecontext->UDF--->C(tgt)

  • IPv6 - Newb Question (BGP Advertisement)

    Hi Everyone - Quick question on IPv6 subnetting
    If we are allocated a /32 from an RIR (eg 2001:0DB0::/32), and we advertise the /32 to our upstream Inet providers - Assigning
    2001:0DB0:0:10::1/64 to a loop Interface, we *should* be able to reach the Upstream providers IPv6 addresses with a source of the loop interface(As the /64 is within the /32 subnet)?
    Cheers.

    Hi John,
    Correct. You should be able to use that technique to perform initial testing for your ipv6 connectivity. You can use extended ping for instance to specify the loopback interface as the source address.
    Regards

  • BGP Advertised Routes two Peering

    Dear all
    I have issue with BGP behaviour. I have two BGP peering; from both I receive default route, but one of them,
    AS 65472 is primary so I setup local preference in 200; it is because I want to use AS 65472 as internet
    provider. The another one, AS 65472 is used as secundary internet access, but for internal network (private) is
    used as primary. The issue is when try ping from LAN, can not reach internal network, seems to be that
    becuase Local preference is setup within AS65472 and the packet try to go thru AS 65472 because local prefeence 200,
    but I need that internal network go thru AS 65471.
    I am sure that I am advertising network as I expect, but when is running BGP for both peering, it fails.
    Here are go output for this situation:
    7204VXR-SCT#sh ip bgp neighbors 172.16.40.37 received-routes
       Network          Next Hop            Metric LocPrf Weight Path
    * i0.0.0.0          172.16.40.37             0    100      0 i
    Total number of prefixes 1
    7204VXR-SCT#sh ip bgp neighbors 172.16.40.37 advertised-routes
       Network          Next Hop            Metric LocPrf Weight Path
    *> 10.10.200.0/30   0.0.0.0                  0         32768 i
    *> 10.30.24.0/21    172.16.40.4              0         32768 i
    *> 172.16.17.0/24   172.16.40.5              0         32768 i
    *> 172.16.211.0/24  0.0.0.0                  0         32768 i
    *> 172.18.56.16/29  0.0.0.0                  0         32768 i
    *> 172.30.100.18/32 0.0.0.0                  0         32768 i
    *> 172.31.0.20/30   0.0.0.0                  0         32768 i
    7204VXR-SCT#sh ip bgp neighbors 190.97.254.241 received-routes
       Network          Next Hop            Metric LocPrf Weight Path
    *  0.0.0.0          190.97.254.241                         0 65472 i
    Total number of prefixes 1
       Network          Next Hop            Metric LocPrf Weight Path
    *> 190.153.116.0/22 172.16.40.4              0         32768 i
    *> 190.153.120.0/22 172.16.40.4              0         32768 i
    *> 190.153.124.0/24 172.16.40.37            10         32768 i
    router bgp 65471
     bgp log-neighbor-changes
     neighbor externalBGP peer-group
     neighbor externalBGP remote-as 65472
     neighbor externalBGP version 4
     neighbor internalBGP-SCT peer-group
     neighbor internalBGP-SCT remote-as 65471
     neighbor internalBGP-SCT version 4
     neighbor 172.16.40.37 peer-group internalBGP-SCT
     neighbor 190.97.254.241 peer-group viginet
     address-family ipv4
     neighbor externalBGPsoft-reconfiguration inbound
     neighbor externalBGProute-map viginet-in in
     neighbor externalBGProute-map viginet-out out
     neighbor internalBGP-SCT soft-reconfiguration inbound
     neighbor internalBGP-SCT route-map internalBGP-SCT-out out
     neighbor 172.16.40.37 activate
     neighbor 190.97.254.241 activate
     no auto-summary
     no synchronization
     network 10.10.200.0 mask 255.255.255.252
     network 10.30.24.0 mask 255.255.248.0
     network 172.16.17.0 mask 255.255.255.0
     network 172.16.40.0 mask 255.255.255.0
     network 172.16.211.0 mask 255.255.255.0
     network 172.18.56.16 mask 255.255.255.248
     network 172.30.100.18 mask 255.255.255.255
     network 172.31.0.20 mask 255.255.255.252
     network 190.153.116.0 mask 255.255.252.0
     network 190.153.120.0 mask 255.255.252.0
     network 190.153.124.0 mask 255.255.255.0
     exit-address-family
    ip route 172.16.40.36 255.255.255.252 Null0 250
    ip route 190.153.116.0 255.255.252.0 172.16.40.4
    ip route 190.153.120.0 255.255.252.0 172.16.40.4
    ip prefix-list invalidas seq 10 permit 172.16.40.0/24
    ip prefix-list invalidas seq 15 permit 10.30.24.0/21
    ip prefix-list invalidas seq 20 permit 172.16.211.0/24
    ip prefix-list invalidas seq 25 permit 172.18.56.16/29
    ip prefix-list invalidas seq 30 permit 172.30.100.18/32
    ip prefix-list invalidas seq 35 permit 10.10.200.0/30
    ip prefix-list invalidas seq 40 permit 172.16.17.0/24
    ip prefix-list invalidas seq 45 permit 172.31.0.20/30
    ip access-list standard viginet-100
     permit 190.153.116.0 0.0.3.255
     permit 190.153.120.0 0.0.3.255
     permit 190.153.124.0 0.0.0.255
    route-map externalBGP-out permit 10
     match ip address viginet-100
    route-map externalBGP-in permit 10
     set local-preference 200
    route-map internalBGP-SCT-out permit 10
     match ip address prefix-list invalidas

    Hello.
    If you want your internal network to go through peer 65471 (to 0.0.0.0/0), then why do you need AS 65472?
    Could you please provide "show ip bgp 0.0.0.0/0"?

  • BGP received-only Question

    Hi
    From what I understand in the show ip bgp x.x.x.x/x output the received-only would be present when soft-reconfiguration inbound is configured and the route has been rejected by a policy i.e. a route map
    What i have also found is that on many outputs i can see the exact same route in the output twice, one which has the received-only keyword and one doesn't.
    Now for a specified neighbor we have a route map configured inbound which will change the weight based on the community value. It seems as though when a route map is configured and an attribute is changed that route appears in the output twice, one being modified and one which is unchanged. But this contradicts what is said on the Cisco website its states 'the received-only keyword will only show up if the route is denied by a policy', but its not.. it's just changed.
    Has anyone had this discussion before? I would like to hear people's thoughts on the matter.
    Thanks
    Andre
    corerouter#show ip bgp | b 10.141.54.0
    * 10.141.54.0/23 10.199.10.18 0 64000 34406 65502 ?
    *> 10.199.10.18 0 64000 34406 65502 ?
    corerouter#sho ip bgp 10.141.54.0/23
    BGP routing table entry for 10.141.54.0/23, version 1219279
    Paths: (4 available, best #3, table Default-IP-Routing-Table)
    Advertised to update-groups:
    2 3 4 5 6 7
    34406 65502
    10.199.10.18 from 10.199.10.20 (82.196.60.60)
    Origin incomplete, metric 0, localpref 100, weight 64000, valid, external
    Community: 10199111
    34406 65502, (received-only)
    10.199.10.18 from 10.199.10.20 (82.196.60.60)
    Origin incomplete, metric 0, localpref 100, valid, external
    Community: 10199111
    34406 65502
    10.199.10.18 from 10.199.10.19 (82.196.60.1)
    Origin incomplete, metric 0, localpref 100, weight 64000, valid, external, best
    Community: 10199111
    34406 65502, (received-only)
    10.199.10.18 from 10.199.10.19 (82.196.60.1)
    Origin incomplete, metric 0, localpref 100, valid, external
    Community: 10199111

    show ip bgp neighbor x.x.x.x received-routes
    show ip bgp neighbor x.x.x.x routes
    sho ip bgp a.b.c.d
    If you found this page, like I did, while searching for "received-only" - that means that the route has only been received, but not entered in the routing table. This is good if you meant to block that route.  But if that route is actually also installed in the routing table and you meant to block it, check your route-map, specifically your prefix-lists and you will likely find that you have an error with wither the IP address or the CIDR mask, resulting in a non-match condition. The inverse is also true if you intend to allow a route but you only see the "received-only" route, you probably have a typo in your route-map or prefix list.  Below are some examples that might help.
    Here are some BGP with route-map and prefix-list examples, although the data is not meaningful. 
    router bgp 1234
      neighbor CARRIER1 peer-group
      neighbor CARRIER1 route-map PROVIDER1-IN in
      neighbor 6.7.8.9 peer group CARRIER1
    route-map PROVIDER1-IN deny 5
      match ip address prefix-list MyIPs
    route-map PROVIDER1-IN permit 10
      match ip address prefix-list GOOG APPL
    ip prefix-list GOOG seq 5 permit 8.8.8.0/24 le 32
    ip prefix-list GOOG seq 10 permit 8.8.4.4/32
    ip prefix-list APPL seq 5 per 17.142.160.59/32
    ip prefix-list APPL seq 10 per 17.178.96.0/24 le 32
    ip prefix-list MyIPs seq 5 per 1.2.0.0/16 le 24
    ip prefix-list MyIPs seq 10 per 2.3.4.0/24 le 32
    ip prefix-list MyIPs seq 15 per 4.5.6.7/32

  • BGP Advertisement to Specific AS Number

    HOw to setup BGP so it will not get advertised to specific AS.
    Example:
    My BGP AS 1000 and i peer with AS 2000 and 3000. I want to tell BGP AS 2000 not to advertise to AS 100, and 200. 
    Or i want to advertise my blocks to all internet but i want to make sure AS 100 and 200 wont have my prefix in the BGP table.
    thanks

    Hello,
     Create a "peer-group" where you will add those two AS to the peer-group. And apply "mhnedirli" solution above...
    and use : 
    neighbor <peer-group-name> route-map BLOCK out

  • BGP advertisements control

    Hello Dears I want to ask about the following case : If I have router in AS 100 with 2 router neighbors ( Assume they are ISPs ) AS 200 & AS 300 and I have networks 192.168.2.0 - 192.168.7.0 I advertise 192.168.2.0 - 192.168.4.0 with one neighbor AS 200 & 192.168.2.0 - 192.168.4.0 with another AS 300 by using route-map . In my design I use default route ( with LSA and track ) ,the requests from these networks routed via the default route and returned from destination via BGP   .  what is the method to control advertisement of networks in case the public service of one ISPs goes down and I want to automatically advertise the networks for this down ISP on the other ISP ?

    Hi, 
    You can prepend prefixes towards your ISPs. Suppose prefix X is transmitted via ISP-A. In that case you announce prefix X towards ISP-A without any prepending and towards ISP-B with prepending, using your own AS at least more than 2 times. This way when ISP-A goes down global traffic will shift through ISP-B for the prefix X. 
    Regards / Tahmeed

  • Many-to-many mapping question

    Hi,
    I'm working with two classes Car and Customer. The Car class has a Vector of Customers and the Customer class has a Vector of Car. Both are related by a many to many mapping.
    I have noticed that I have to set one of the vector to read only to avoid the error message "More than one writable many-to-many mapping can not use the same relation table" in the mapping workbench.
    I can understand that but is there a way to work around, I mean to be able to add a car to a customer and add a customer to a car with the both vectors?
    Is there something to do with the cache?
    I use Vector for the collection or Map class, have I to do otherwise?

    Hello Vladislav, I understand your first question in this thread, but I'm not sure I follow the rest, so let me respond to your first post:
    "I have noticed that I have to set one of the vector to read only to avoid the error message "More than one writable many-to-many mapping can not use the same relation table" in the mapping workbench.
    I can understand that but is there a way to work around, I mean to be able to add a car to a customer and add a customer to a car with the both vectors?"
    The issue here is that with a Many to Many mapping the mapping is responsible for writing to the association table. So, you have a "CAR_CUST" association table. Imagine you add a Car "101" to a customer "501" and the requisite customer "501" to that car "101" in your object model. Then the association table should only be updated once, with an entry of "101, 501". But since the M-M is mapped in both directions, you need to tell TopLink which of these to consider as the "master" when updating the database.
    If you didn't make one of the M-M mappings "read only", then TopLink would insert "101, 501" twice in the association table, and then at a later date you would see that the customer 501 had two 101 cars!
    We do have a feature that allows for TopLink to maintain bidirectional relationships such that if you add or remove a target from one relationship, TopLink will automatically add/remove it from the opposite direction. In my opinion this is lazy programming! A good Java developer should insist on keeping his model up to date on his own. This feature was added because it's part of the EJB spec, not necessarily because it's a good idea ;)
    - Don
    Is there something to do with the cache?
    I use Vector for the collection or Map class, have I to do otherwise?

  • Mapping question

    Hello,
    I have a rather simple question regarding a mapping.
    Lets say my input message is as following:
    <mes1>
       <seg1>
          <name1>Peter</name1>
          <street1>HighCrt</street1>
       </seg1>
       <seg2>
          <name2>Vlad</name2>
          <sub2>Trickst</sub2>
       </seg2>
       <seg2>
          <name2>Rinaldo</name2>
          <sub2>fiave</sub2>
       </seg2>
    </mes1>
    My output should be:
    <out>
       <put>
          <name>Peter</name>
          <name>Vlad</name>
          <name>Rinaldo</name>
       </put>
    </out>
    So my output field "name" should created in case I have a "name1" field in the source message and additionally it should be created for every "seg2" element that is present in the source message and it should be filled with the value of "name2".
    How can I in the mapping trigger that the "name" element of the output message will be generated for each of the two described elements of the source message?
    Best Regards,
    Peter

    Hi,
    Could be possible using user defined function.
    Create a user defined Function with  cache = context
    public void createNodeName(String[] a,String[] b,ResultList result,Container container){
    if ( a.length > 0 )
      result.addValue ( a[0] ) ;
    for ( int i = 0; i < b.length; i++ )
         result.addValue ( b<i> );
    in Mapping use
    1. name1 as first argument
    2. name2 with removeContext as second argument

  • Mapping - Questions

    Hi,
       I have few basic questions regarding mappings.
       1)  I think we can do everything by using Graphical Mapping. Then what is the purpose for Java, XSLT and ABAP mapping? Please give me an example for this...
       2) Which mapping will give better performance? Is there any comparison document available in SDN?
      Appreciate your help!
    Thanks,
    Vivek

    hi,
    Mapping Techniques
    XI provides 3 standard ways of interface mapping between source and target.
    Graphical mapping
    Java Mapping
    XSLT Mapping
    Two more additional mapping types can be activated in XI by making changes to the exchange profile. Those two mappings are
    ABAP mapping
    XSLT mapping with ABAP Extensions
    Graphical Mapping
    Graphical mapping is a common approach followed by everyone for generating desired target structure. It involves simple drag-n-drop to correlate respective nodes (fields) from source and target structure. It hardly involves coding. (Exception - User defined functions). But sometimes with graphical mapping it is difficult to produce required output. For example ... text/html output, namespace change, sorting or grouping of records etc.
    ABAP Mapping
    A person comfortable with Object Oriented ABAP can go for ABAP mapping instead.
    Java Mapping
    Java Mapping uses 2 types of parsers. DOM and SAX. DOM is easier to use with lots of classes to help you create nodes and elements, but , DOM is very processor intensive.
    SAX parser is something that parses your XML one after the other, and so is not processor intensive. But, it is not exaclty easy to develop either.
    XSLT Mapping
    One can also think of Java mapping as another option but it is a bit complex and required knowledge of Java. In such cases, XSLT mapping can be the best approach to meet the requirements.
    check these links too..
    Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/b78d406b305537e10000000a1550b0/frameset.htm
    For Java Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    For XSLT Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
    Error handling in XSLT Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/8a/7672f7d7e444439fd7024f806221a4/frameset.htm
    You can also refer some How to guides:
    XI New Mapping Features article,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi%203.0%20new%20mapping%20features%20article.evn
    Generic XSLT Mapping and Sample Code,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi%20code%20samples/generic%20xslt%20mapping%20and%20sample%20code.pdf
    How to use ABAP-MApping in XI3.0,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how%20to%20use%20abap-mapping%20in%20xi%203.0.pdf
    Thanks,
    Vijaya.

  • ABAP Mapping Questions

    Hi,
    I am trying to get my head around ABAP mappings and have a few questions.
    In the below code sample which I find in every example and blog it talks about specific steps -
    *initialize iXML, * create iXML factory object, * create streamfactory object, * create input stream object, * initialize the input xml document, * parse the input xml document
    In these steps the code is always exactly the same so my question is are these just standard steps that are implemented every single time an abap mapping is used and hence only standard lines that never have to be changed or will they be different depending on the mapping.
    I am trying to work out where I will begin my coding.
    So would somebody be so kind as to give me a brief explanation of the above mentioned steps.
    Thank you
    METHOD if_mapping~execute.
    * initialize iXML
      TYPE-POOLS: ixml.
      CLASS cl_ixml DEFINITION LOAD.
    * create iXML factory object
      DATA: ixmlfactory TYPE REF TO if_ixml.
      ixmlfactory = cl_ixml=>create( ).
    * create streamfactory object
      DATA: streamfactory TYPE REF TO
      if_ixml_stream_factory.
      streamfactory = ixmlfactory->create_stream_factory( ).
    * create input stream object
      DATA: istream TYPE REF TO if_ixml_istream.
      istream = streamfactory->create_istream_xstring( source ).
    * initialize the input xml document
      DATA: idocument TYPE REF TO if_ixml_document.
      idocument = ixmlfactory->create_document( ).
    * parse the input xml document
      DATA: iparser TYPE REF TO if_ixml_parser.
      iparser = ixmlfactory->create_parser(
      stream_factory = streamfactory
      istream = istream
      document = idocument ).
      iparser->parse( ).

    Hi,
         The above lines you mentioned deal with initialization of the iXML parser for parsing through the XML payload, so they would remain the same for all mapping where you are parsing the input payload.
    The coding for you specific mapping will begin after this, something like :
    * Implements the DOM generating interface to the parser
      iparser->parse( ).
      emp_node_collection = idocument->get_elements_by_tag_name_ns( name = 'Order' ).
      emp_node_length = emp_node_collection->get_length( ).
      emp_node_iterator = emp_node_collection->create_iterator( ).
    where you start reading the xml node values.
    Hope this helps.
    Regards

  • One to one mapping question -- can I just map a lookup field for queries?

    I have a table with a state code. I'd like to have a "virtual lookup" on the java class to a region table. I.e., this java class "studies" has a state code. I can map a one-to-one to the descriptor class that has the ref table, but I'd like to have a property in the java class pre-mapped to the "region" field in this lookup so for querying i can just use:
    ReadAllQuery q = new ReadAllQuery();
    q.setReferenceClass(study.class);
    q.setSelectionCriteria(new ExpressionBuilder().get("Region").equal(Region));
    to get all the studies for a particular region.
    am I going about this wrong? or do I have to get the reference table descriptor fromt he one to one map and do something different?

    well,on the way home last nite, I realized I'd had a complete brain fart. I've done this before. I just set up a 1-1 map between descriptors and then built the query like this:
    q.setSelectionCriteria(new ExpressionBuilder().get("refFPO").get("FPO_NO").equal(FPO));
    You can get the pointer to the "refFPO" which is the the descriptor mapped 1-1, then appended the column you wish to get.
    I still went ahead and amended my class to include a read-only, non-toplink mapped attribute "FPO" which just gets the reference variable pointing to "refFPO.getFPO_NO();
    I answered my own question just in case anyone wondered ....

Maybe you are looking for

  • IPhoto '09 crashing after rebuilding library - crash log included

    My problems started when I tried to rebuild my library so I could burn back-up DVD's for my iPhoto library. Along the way I realized Time Machine never backed up my iPhoto library (although it backed up everything else on my internal and external HD'

  • Bluetooth N73 and N78 problem

    Hi, all. I have very special problem with connection N73 and N78 with my BT HF Pioneer radio, there is firmware problem. I dont need the stock answares like "reset your phone" etc. I want to disscous the problem with some real nokia technical support

  • Calculating distances

    Hi, i need some guidance, i need to calculate the distances between two atoms (all combinations). Each atom as x, y and z axis points e.g. x y z ATOM 5 CA PHE 1 113.142 75.993 130.862 ATOM 25 CA ARG 2 113.940 72.288 131.419 ATOM 49 CA TYR 3 116.236 7

  • Cannot install adobe flash professional cs5.5

    Hi I am not able to install adobe flash professional cs5.5 as it takes a lot of time to install and uses complete cpu resources and because of this the cpu and the whole computer heats up and shuts off. I tried to prevent the heating by putting ice a

  • Manipulating Camera Raw settings with javascript

    Is it possible to manipulate the Camera Raw settings with a javascript? I've been looking for info on this and have had no luck finding any. What I'm doing is multiple conversions from a single RAW file set at different exposures, brightnesses, sharp