def _get_vlan_real_dev_id(self, vlan_dev_id, vlan_id): ''' Gets real netdev id by given vlan netdev id and vlan id ''' dump = self._nc.dump_config() netdev = dump[vlan_dev_id] if (netdev["type"] == "vlan" and int(get_option(netdev, "vlan_tci")) == vlan_id): return netdev["slaves"][0]
def _get_vlan_dev_id(self, real_dev_id, vlan_id): ''' Gets vlan netdev id by given real netdev id and vlan id ''' dump = self._nc.dump_config() for key in dump: netdev = dump[key] if (netdev["type"] == "vlan" and netdev["slaves"][0] == real_dev_id and int(get_option(netdev, "vlan_tci")) == vlan_id): return key
def _get_dev_tagged_vlans(self, dev_id): ''' Gets vlan ids of all vlan the netdevice is part of ''' vlans = [] dump = self._nc.dump_config() for key in dump: netdev = dump[key] if (netdev["type"] == "vlan" and netdev["slaves"][0] == dev_id): vlans.append(int(get_option(netdev, "vlan_tci"))) return vlans