Exa-Networks / exabgp

The BGP swiss army knife of networking
Other
2.09k stars 447 forks source link

exabgp/reactor/peer.py #160

Closed robert-hatch closed 10 years ago

robert-hatch commented 10 years ago

Very simple demo config with routeros pushing a single route to exabgp and i am getting this error:

Sat, 16 Aug 2014 22:25:57 | INFO | 2618 | configuration | analysing tokens ['}'] Sat, 16 Aug 2014 22:25:57 | INFO | 2618 | configuration | valid block options ['static', 'flow', 'l2vpn', 'neighbor', 'process', 'family', 'capability', 'operational'] Sat, 16 Aug 2014 22:25:57 | INFO | 2618 | configuration | valid parameters ['description', 'router-id', 'local-address', 'local-as', 'peer-as', 'passive', 'hold-time', 'add-path', 'graceful-restart', 'md5', 'ttl-security', 'multi-session', 'group-updates', 'route-refresh', 'asn4', 'aigp', 'auto-flush', 'adj-rib-out'] Sat, 16 Aug 2014 22:25:57 | INFO | 2618 | reactor | New Peer neighbor xxx.xxx.xxx.xxx local-ip yyy.yyy.yyy.yyy local-as 65107 peer-as 65107 router-id yyy.yyy.yyy.yyy family-allowed in-open Sat, 16 Aug 2014 22:25:57 | WARNING | 2618 | configuration | Loaded new configuration successfully Sat, 16 Aug 2014 22:25:57 | INFO | 2618 | processes | Forked process parsed-route-backend Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | message | Peer xxx.xxx.xxx.xxx ASN 65107 >> OPEN version=4 asn=65107 hold_time=180 router_id=yyy.yyy.yyy.yyy capabilities=[Multiprotocol(ipv4 unicast,ipv6 unicast), ASN4(65107)] Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | message | Peer xxx.xxx.xxx.xxx ASN 65107 << OPEN Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | message | Peer xxx.xxx.xxx.xxx ASN 65107 << OPEN version=4 asn=65107 hold_time=180 router_id=xxx.xxx.xxx.xxx capabilities=[Multiprotocol(ipv4 unicast), Route Refresh, ASN4(65107)] Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | message | Peer xxx.xxx.xxx.xxx ASN 65107 >> KEEPALIVE (OPENCONFIRM) Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | message | Peer xxx.xxx.xxx.xxx ASN 65107 << KEEPALIVE Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | network | Connected to peer neighbor xxx.xxx.xxx.xxx local-ip yyy.yyy.yyy.yyy local-as 65107 peer-as 65107 router-id yyy.yyy.yyy.yyy family-allowed in-open (out) Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | parser | parsing flag 40 type 01 (origin) len 01 payload 00 Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | parser | parsing flag 40 type 02 (as-path) len 00 Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | parser | parsing flag 40 type 03 (next-hop) len 04 payload 050A 900D Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | parser | parsing flag 40 type 05 (local-preference) len 04 payload 0000 0064 Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | parser | no withdrawn NLRI Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | parser | parsing 1/1 nlri payload 00 Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | parser | parsed announce nlri 0.0.0.0/0 next-hop xxx.xxx.xxx.xxx payload 00 Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | message | Peer xxx.xxx.xxx.xxx ASN 65107 << UPDATE Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | reactor | peer xxx.xxx.xxx.xxx ASN 65107 UNHANDLED PROBLEM, please report Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | reactor | peer xxx.xxx.xxx.xxx ASN 65107 <type 'exceptions.KeyError'> Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | reactor | peer xxx.xxx.xxx.xxx ASN 65107 '' Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | Traceback (most recent call last): Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | File "/opt/scripts/exabgp/lib/exabgp/reactor/peer.py", line 555, in _run Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | for action in self._main(direction): Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | File "/opt/scripts/exabgp/lib/exabgp/reactor/peer.py", line 449, in _main Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | for message in proto.read_message(): Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | File "/opt/scripts/exabgp/lib/exabgp/reactor/protocol.py", line 160, in read_message Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | self.peer.reactor.processes.message(msg,self.peer,message,'','') Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | File "/opt/scripts/exabgp/lib/exabgp/reactor/api/processes.py", line 289, in message Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | self._dispatchmessage_id Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | File "/opt/scripts/exabgp/lib/exabgp/reactor/api/processes.py", line 296, in wrap Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | f(*args) Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | File "/opt/scripts/exabgp/lib/exabgp/reactor/api/processes.py", line 317, in _update Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | self.write(header,body),peer,process,self._api_encoder[process].update(peer,update) Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | File "/opt/scripts/exabgp/lib/exabgp/reactor/api/processes.py", line 214, in write Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | self._process[process].stdin.write('%s\n' % string) Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | KeyError: '' Sat, 16 Aug 2014 22:26:00 | ERROR | 2618 | | Sat, 16 Aug 2014 22:26:00 | INFO | 2618 | network | Peer xxx.xxx.xxx.xxx ASN 65107 out loop, peer reset, message [] error[]

thomas-mangin commented 10 years ago

Hello, which version ?

thomas-mangin commented 10 years ago

And can I have your configuration file please

robert-hatch commented 10 years ago

Many thanks, current version (3.4.2), commit 8d600d98424bce83ceb8a30d49fbcbb8d64436fa

group gixlg { hold-time 180; local-as 65107; router-id yyy.yyy.yyy.yyy;

family {
    ipv4 unicast;
    ipv6 unicast;
}

process parsed-route-backend {
    receive {
        neighbor-changes;
        parsed;
        update;
    }
    run /opt/scripts/gixlg/exabgp/collector.py exabgp;
    encoder json;
}

neighbor  xxx.xxx.xxx.xxx {
    local-address yyy.yyy.yyy.yyy;
    peer-as 65107;
    description "ROS R1";
    group-updates;
}

}

thomas-mangin commented 10 years ago

group-updates under neighbor is not valid, but I doubt this is the issue.

robert-hatch commented 10 years ago

thanks,

group-updates under neighbour is from the gixlg default config but even without it there is the same error.

thomas-mangin commented 10 years ago

Found the culprit .. A very bad regex at the origin of commit 60551282604a022141cdbe5b167750844e75ebcb - patch 53c39915acd5449ad8823a53ee741894f87cd067 should therefore fix the code for good, please let me know if not as i did not test it .. It is late and I am doing other things.

robert-hatch commented 10 years ago

thanks, all working now. thanks for the prompt fix!

thomas-mangin commented 10 years ago

No issue, sorry for introducing a bug ...