Skip to content

Commit

Permalink
- update mod template
Browse files Browse the repository at this point in the history
  • Loading branch information
cklewar committed Apr 10, 2018
1 parent 2ffd5c5 commit 0e28da1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions template/mod-flow-route.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ routing-options {
route {{ flowRouteName }} {
replace:
match {
{%- if dstPrefix is defined and dstPrefix !=None %}
destination {{dstPrefix}};
{%- endif %}
{%- if dstPort is defined and dstPort !=None %}
destination-port {{ dstPort }};
{%- endif %}
Expand Down
2 changes: 2 additions & 0 deletions ui/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
age_out_interval: 00:03:00
dev_pw: juniper123
dev_user: root
communities:
- bgp_flow_arbor:1000:1666
routers:
- RR:
type: rr
Expand Down
8 changes: 2 additions & 6 deletions utils/testdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
dev_user = config['dev_user']
dev_pw = config['dev_pw']
routers = config['routers']
communities = config['communities']

my_router = None
for router in routers:
Expand All @@ -34,7 +35,6 @@
step = 1
protocol = ['tcp', 'udp']
action = ['accept', 'discard', 'sample', 'community']
communities = ['bgp_flow_arbor:1000:1666']

for idx in range(start, stop, step):
testdata['flowRoute' + str(idx)] = {
Expand All @@ -44,11 +44,9 @@
random.randint(1, 200)),
'protocol': protocol[random.randint(0, 1)], 'dstPort': '{0}'.format(random.randint(1, 9999)),
'srcPort': '{0}'.format(random.randint(1, 9999)),
'action': '{0} {1}'.format(action[3],communities[0]) if 'community' in action[
'action': '{0} {1}'.format(action[3],communities[random.randint(0, len(communities)-1)]) if 'community' in action[
random.randint(0, 3)] else action[random.randint(0, 2)]}

#pprint.pprint(testdata)

env = Environment(autoescape=False,
loader=FileSystemLoader('../template'), trim_blocks=False, lstrip_blocks=False)
template = env.get_template('set-flow-route.conf')
Expand All @@ -58,8 +56,6 @@
for key, flow in testdata.iteritems():
_template.write(template.render(flowRouteName=key, **flow))

#print _template.getvalue()

try:

cu = Config(dev)
Expand Down

0 comments on commit 0e28da1

Please sign in to comment.