SwitchPort.py 486 B

1234567891011121314151617181920
  1. from Base import Base
  2. from Util import Strings
  3. class SwitchPort(Base):
  4. def __init__(self):
  5. Base.__init__(self)
  6. def get_vlan_id(self):
  7. """
  8. Obtain vlan id from property name
  9. :return: Returns id of the vlan or blank
  10. """
  11. data_compare = self.name.lower().split()
  12. index = Strings.index_value(data_compare, "vlan")
  13. if index >= 0:
  14. return data_compare[index + 1].strip()
  15. else:
  16. return ""