Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aci-show-lldp.py cannot retrieve chassisIdV value #372

Open
OdieArbuckle opened this issue Mar 22, 2021 · 0 comments
Open

aci-show-lldp.py cannot retrieve chassisIdV value #372

OdieArbuckle opened this issue Mar 22, 2021 · 0 comments

Comments

@OdieArbuckle
Copy link

OdieArbuckle commented Mar 22, 2021

Hello,

We've been using cisco ACI for a couple of months now and it's clear you need automation tools such as python to help with retrieving information from the fabric and configuring it.
However, when I use the show lldp python script from ACItoolkit, it works, but I cannot seem to retrieve the "ChassisIdV" value.

image

In the chassis_id_t column I can see generic values but not the values I'm intereseted in. I've looked up the object class in ACI and confirmed that it should be a different property. I tried modifying several of the scripts in the toolkit but I cannot seem to poll the right attribute. The right one should be "chassisIdV". It contains the vmnic number if there is a server connected to the interface.

original aciConcreteLib.py code snippets

    def get_table(lldps, title=''):
        """
        Returns cdp information in a displayable format.
        :param title:
        :param lldps:
        """
        result = []
        headers = ["Node-ID", "Ip", "Name", "Chassis_id_t", "Neighbour Platform", "Neighbour Interface"]
        data = []
        for lldp in lldps:
            for lldpIf in lldp.get_children(ConcreteLLdpIf):
                for adjEp in lldpIf.get_children(ConcreteLLdpAdjEp):
                    node_match = re.search(r'node-\d+', adjEp.raw_local_interface)
                    node = node_match.group()
                    local_int_match = re.search(r'(\[)([\w\d\/]+)', adjEp.raw_local_interface)
                    local_int = local_int_match.group(2)
                    data.append([
                        node,
                        local_int,
                        adjEp.ip,
                        adjEp.name,
                        adjEp.chassis_id_t,
                        adjEp.mac,
                        str(adjEp.neigh_int)
                    ])
                result.append(Table(data, headers, title=title + 'LLDP Entries'))

        return result`

def _populate_from_attributes(self, attributes):
        """
        This will populate from the APIC attribute

        :param attributes: Attributes of the APIC object
        """
        self.ip = attributes['mgmtIp']
        self.name = attributes['sysName']
        self.chassis_id_t = attributes['chassisIdT']
        if self.chassis_id_t == 'mac':
           self.mac = str(attributes['chassisIdV'])
        else:
           self.mac = str(attributes['mgmtPortMac'])
        self.raw_local_interface = str(attributes['dn'])
        self.neigh_int = str(attributes['portIdV'])

Can anyone point me in the right direction here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant