d7330d0f44
Primary reason for this change was to update the spec and setup files from basic setuptools to use pbr This allows the autogenerated /usr/bin/system file to directly call the main method without using pkg-resources. This will provide a performance improvement of .5 seconds per CLI call, once the other pkg_resources issues are resolved Second reason for this change was to wire in the tox unit tests. This also includes pep8, pylint and coverage. Currently pep8 does not perform the 80 char limit check Currently pylint still reports some issues This should not affect the RPM names being generated or otherwise affect patching or upgrades. Change-Id: I9f14c9216fdcc63930a4b2849102b58442706144
36 lines
838 B
Python
36 lines
838 B
Python
#
|
|
# Copyright (c) 2016 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
# -*- encoding: utf-8 -*-
|
|
#
|
|
|
|
from cgtsclient.common import base
|
|
|
|
|
|
class LldpNeighbour(base.Resource):
|
|
def __repr__(self):
|
|
return "<LldpNeighbour %s>" % self._info
|
|
|
|
|
|
class LldpNeighbourManager(base.Manager):
|
|
resource_class = LldpNeighbour
|
|
|
|
def list(self, ihost_id):
|
|
path = '/v1/ihosts/%s/lldp_neighbours' % ihost_id
|
|
neighbours = self._list(path, "lldp_neighbours")
|
|
return neighbours
|
|
|
|
def list_by_port(self, port_id):
|
|
path = '/v1/ports/%s/lldp_neighbours' % port_id
|
|
return self._list(path, "lldp_neighbours")
|
|
|
|
def get(self, uuid):
|
|
path = '/v1/lldp_neighbours/%s' % uuid
|
|
try:
|
|
return self._list(path)[0]
|
|
except IndexError:
|
|
return None
|