Skip to content

Commit

Permalink
Fix dn required for interface stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Smith committed Jan 27, 2017
1 parent 59b8603 commit 59c5bbe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion acitoolkit/aciphysobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -2480,7 +2480,11 @@ def __init__(self, interface_type, pod, node, module, port,
self._parent = parent
if parent:
self._parent.add_child(self)
self.stats = InterfaceStats(self, self.attributes.get('dn'))
try:
dn = self.attributes['dn']
except KeyError:
dn = 'topology/pod-%s/node-%s/sys/phys-[%s%s/%s]' % (pod, node, interface_type, module, port)
self.stats = InterfaceStats(self, dn)

self.attributes['interface_type'] = str(interface_type)
self.attributes['pod'] = str(pod)
Expand Down
2 changes: 2 additions & 0 deletions acitoolkit/acitoolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from .aciphysobject import Interface, Fabric
from .acisession import Session
from .aciTable import Table
from .acicounters import InterfaceStats
from .acitoolkitlib import Credentials


Expand Down Expand Up @@ -4666,6 +4667,7 @@ def __init__(self, if_type, pod, node, fex, module, port):
self.if_name += self.module + '/' + self.port
self._session = None
self.attributes = {'if_name': self.if_name}
self.stats = InterfaceStats(self, self.attributes.get('dn'))

@classmethod
def parse_dn(cls, dn):
Expand Down

0 comments on commit 59c5bbe

Please sign in to comment.