Skip to content

Commit

Permalink
Update main.py. Should work for python 3 and 2
Browse files Browse the repository at this point in the history
  • Loading branch information
knewell committed Apr 10, 2019
1 parent 3d15275 commit f70896d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def addNewFlowRoute(self, flowRouteData=None):
my_router = None
for router in self.routers:

for name, value in router.iteritems():
for name, value in router.items():
if 'rr' in value['type']:
my_router = [value['ip']]

Expand Down Expand Up @@ -99,7 +99,7 @@ def modFlowRoute(self, flowRouteData=None):
my_router = None
for router in self.routers:

for name, value in router.iteritems():
for name, value in router.items():
if 'rr' in value['type']:
my_router = [value['ip']]

Expand Down Expand Up @@ -130,7 +130,7 @@ def delFlowRoute(self, flowRouteData=None):
my_router = None
for router in self.routers:

for name, value in router.iteritems():
for name, value in router.items():
if 'rr' in value['type']:
my_router = [value['ip']]

Expand Down Expand Up @@ -163,7 +163,7 @@ def getActiveFlowRoutes(self):

for router in self.routers:

for name, value in router.iteritems():
for name, value in router.items():

with Device(host=value['ip'], user=self.dev_user, password=self.dev_pw) as dev:

Expand Down Expand Up @@ -204,7 +204,7 @@ def getActiveFlowRoutes(self):
_item = item.split('=')
destination[index] = _item[1] if len(_item) > 1 else _item[0]

hash_object = hashlib.sha512(b'{0}{1}'.format(str(destination), str(value['ip'])))
hash_object = hashlib.sha512('{0}{1}'.format(str(destination), str(value['ip'])).encode('utf-8'))
hex_dig = hash_object.hexdigest()
_age = dict()

Expand Down Expand Up @@ -305,7 +305,7 @@ def getActiveFlowRouteFilter(self):

for router in self.routers:

for name, value in router.iteritems():
for name, value in router.items():
self.filter_active[name] = list()

with Device(host=value['ip'], user=self.dev_user, password=self.dev_pw) as dev:
Expand Down Expand Up @@ -347,7 +347,7 @@ def loadFlowRouteConfig(self):

for router in self.routers:

for name, value in router.iteritems():
for name, value in router.items():

if 'rr' in value['type']:
dev_ip.append(value['ip'])
Expand Down Expand Up @@ -447,7 +447,7 @@ def loadFlowRouteConfig(self):
for route in _data['route']:
_action = dict()

for key, value in route['then'].iteritems():
for key, value in route['then'].items():

if value[0]:
_action[key] = {'value': value}
Expand Down

0 comments on commit f70896d

Please sign in to comment.