sk2/autonetkit — Issue #161: How to create a library file? (URGENT)
Author: olafm
Created: 2012-01-18 11:09:29+00:00
State: open

The library does not work for me. This might be a usage-issue and not a bug, but neither Iain, Askar or me could get it to work.
what are we doing wrong?

i've got inspired by bgp-wegdige.policy. I've created "bgp-wedgie_lib.policy", which contains library functions, e.g. i've tried to get rid of the redundant information and write the "prefer customer" policy as function... but i had problems compiling:

autonetkit -f bgp-wedgie.graphml --olive --isis --bgp_policy=bgp-wedgie_lib.policy --deploy -p
2012-01-17 20:18:41,503 INFO Loading
2012-01-17 20:18:41,506 INFO Compiling
2012-01-17 20:18:41,511 INFO Applying BGP policy from bgp-wedgie.policy
Traceback (most recent call last):
File "/usr/local/bin/autonetkit", line 8, in
load_entry_point('AutoNetkit==0.5.65dev-20120117', 'console_scripts', 'autonetkit')()
File "/Library/Python/2.7/site-packages/AutoNetkit/console_script.py", line 81, in main
inet.compile()
File "/Library/Python/2.7/site-packages/AutoNetkit/internet.py", line 297, in compile
pol_parser.apply_policy_file(self.policy_file)
File "/Library/Python/2.7/site-packages/AutoNetkit/algorithms/bgp_policy.py", line 840, in apply_policy_file
self.apply_bgp_policy(line)
File "/Library/Python/2.7/site-packages/AutoNetkit/algorithms/bgp_policy.py", line 331, in apply_bgp_policy
result = self.bgpPolicyLine.parseString(qstring)
File "/Library/Python/2.7/site-packages/pyparsing.py", line 1032, in parseString
raise exc
pyparsing.ParseException: Expected "(" (at char 4), (line:1, col:5)

where the policy (--bgp_policy) file has the following information:

me1 = { AS3 }
cust1 = { AS2 }

me2 = { AS4 }
cust2 = { AS1 }

def pref_cust( me, cust ):
cust ->ingress me: (setLP 120)

pref_cust( me1, cust1 )
pref_cust( me2, cust2 )

(Network = AS1 ) egress-> (Network = AS2): (addTag deprefme)
(Network = AS1 ) ->ingress (Network = AS2): (if tag = deprefme then setLP 90)

... where is my mistake? i can't find it. thanks