如何获取节点端口配置

时间:2019-06-07 12:00:56

标签: python networking ietf-netconf

在我的python项目中,我正在使用ncclient(用于联网的python模块)。 使用此模块,我可以获取机器的lldp详细信息,例如mac_address,ipaddress,供应商,10gig,25gig,50gig端口等的计数。但是我不知道如何知道10gig或25gig或50gig端口中的哪个是up或下。任何帮助将非常感激。 使用paramiko模块连接到远程计算机。

from ncclient import manager

with manager.connect(host = hostname,
                            username = self.user,
                            password = self.password,
                            hostkey_verify=False, 
                            allow_agent=False,
                            look_for_keys=False) as netconf_manager:
print netconf_manager

filter_cmm = '''<cmmStackUnitTable></cmmStackUnitTable>'''

data_cmm = netconf_manager.get(('subtree', filter_cmm))
node.update({'_key': self.hostname, 'ModelName' : data['cmmStackUnitModelName']})
        node.update({'_key': self.hostname, 'MAC' : data['cmmStackUnitMacAddress']})
        node.update({'_key': self.hostname, 'SwitchChipRev' : data['cmmStackUnitSwitchChipRev']})
        node.update({'_key': self.hostname, 'VendorName' : data['cmmStackVendorName']})
        node.update({'_key': self.hostname, 'OnieVersion' : data['cmmStackOnieVersion']})
        node.update({'_key': self.hostname, 'Noof10G' : data['cmmStackUnitNum10GigEtherPorts']})
        node.update({'_key': self.hostname, 'Noof25G' : data['cmmStackUnitNum25GigEtherPorts']})
        node.update({'_key': self.hostname, 'Noof40G' : data['cmmStackUnitNum40GigEtherPorts']})
        node.update({'_key': self.hostname, 'Noof50G' : data['cmmStackUnitNum50GigEtherPorts']})
        node.update({'_key': self.hostname, 'Noof100G' : data['cmmStackUnitNum100GigEtherPorts']})
        node.update({'_key': self.hostname, 'TopologyKey' : self.topo_key})

这是大代码的一部分。一切都很好。但是如上所述,我需要一些额外的信息。

0 个答案:

没有答案