Skip to content
Permalink
Browse files

- update mod template

  • Loading branch information...
cklewar
cklewar committed Apr 10, 2018
1 parent 2ffd5c5 commit 0e28da180f1042c1b799e07a45e6f460cd2cb131
Showing with 6 additions and 6 deletions.
  1. +2 −0 template/mod-flow-route.conf
  2. +2 −0 ui/config.yml
  3. +2 −6 utils/testdata.py
@@ -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 %}
@@ -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
@@ -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:
@@ -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)] = {
@@ -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')
@@ -58,8 +56,6 @@
for key, flow in testdata.iteritems():
_template.write(template.render(flowRouteName=key, **flow))

#print _template.getvalue()

try:

cu = Config(dev)

0 comments on commit 0e28da1

Please sign in to comment.
You can’t perform that action at this time.