diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/utils/__init__.py | 1 | ||||
| -rw-r--r-- | python/vyos/utils/network.py | 11 | 
2 files changed, 10 insertions, 2 deletions
diff --git a/python/vyos/utils/__init__.py b/python/vyos/utils/__init__.py index 0d3998053..5c7a9ecb8 100644 --- a/python/vyos/utils/__init__.py +++ b/python/vyos/utils/__init__.py @@ -14,3 +14,4 @@  # License along with this library.  If not, see <http://www.gnu.org/licenses/>.  from vyos.utils import network +from vyos.utils import boot diff --git a/python/vyos/utils/network.py b/python/vyos/utils/network.py index 7386d44f0..209bc9ecc 100644 --- a/python/vyos/utils/network.py +++ b/python/vyos/utils/network.py @@ -13,8 +13,6 @@  # You should have received a copy of the GNU Lesser General Public  # License along with this library.  If not, see <http://www.gnu.org/licenses/>. -import os -  def get_protocol_by_name(protocol_name):      """Get protocol number by protocol name @@ -34,3 +32,12 @@ def interface_exists_in_netns(interface_name, netns):      if rc == 0:          return True      return False + +def get_interface_vrf(interface): +    """ Returns VRF of given interface """ +    from vyos.util import dict_search +    from vyos.util import get_interface_config +    tmp = get_interface_config(interface) +    if dict_search('linkinfo.info_slave_kind', tmp) == 'vrf': +        return tmp['master'] +    return 'default'  | 
