| @@ 43-69 (lines=27) @@ | ||
| 40 | return True |
|
| 41 | ||
| 42 | ||
| 43 | @ParseL2VPN.register('vpls','append-route') |
|
| 44 | def vpls (tokeniser): |
|
| 45 | change = Change( |
|
| 46 | VPLS(None,None,None,None,None), |
|
| 47 | Attributes() |
|
| 48 | ) |
|
| 49 | ||
| 50 | while True: |
|
| 51 | command = tokeniser() |
|
| 52 | ||
| 53 | if not command: |
|
| 54 | break |
|
| 55 | ||
| 56 | action = ParseVPLS.action[command] |
|
| 57 | ||
| 58 | if 'nlri-set' in action: |
|
| 59 | change.nlri.assign(ParseVPLS.assign[command],ParseL2VPN.known[command](tokeniser)) |
|
| 60 | elif 'attribute-add' in action: |
|
| 61 | change.attributes.add(ParseL2VPN.known[command](tokeniser)) |
|
| 62 | elif action == 'nexthop-and-attribute': |
|
| 63 | nexthop,attribute = ParseVPLS.known[command](tokeniser) |
|
| 64 | change.nlri.nexthop = nexthop |
|
| 65 | change.attributes.add(attribute) |
|
| 66 | else: |
|
| 67 | raise ValueError('vpls: unknown command "%s"' % command) |
|
| 68 | ||
| 69 | return [change,] |
|
| 70 | ||
| @@ 154-179 (lines=26) @@ | ||
| 151 | return True |
|
| 152 | ||
| 153 | ||
| 154 | def l2vpn_vpls (tokeniser,afi,safi): |
|
| 155 | change = Change( |
|
| 156 | VPLS(None,None,None,None,None), |
|
| 157 | Attributes() |
|
| 158 | ) |
|
| 159 | ||
| 160 | while True: |
|
| 161 | command = tokeniser() |
|
| 162 | ||
| 163 | if not command: |
|
| 164 | break |
|
| 165 | ||
| 166 | action = AnnounceVPLS.action[command] |
|
| 167 | ||
| 168 | if 'nlri-set' in action: |
|
| 169 | change.nlri.assign(AnnounceVPLS.assign[command],AnnounceVPLS.known[command](tokeniser)) |
|
| 170 | elif 'attribute-add' in action: |
|
| 171 | change.attributes.add(AnnounceVPLS.known[command](tokeniser)) |
|
| 172 | elif action == 'nexthop-and-attribute': |
|
| 173 | nexthop,attribute = AnnounceVPLS.known[command](tokeniser) |
|
| 174 | change.nlri.nexthop = nexthop |
|
| 175 | change.attributes.add(attribute) |
|
| 176 | else: |
|
| 177 | raise ValueError('vpls: unknown command "%s"' % command) |
|
| 178 | ||
| 179 | return [change,] |
|
| 180 | ||
| 181 | ||
| 182 | @ParseAnnounce.register('vpls','extend-name','l2vpn') |
|