aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2019-07-25 11:09:23 +0000
committerVratko Polak <vrpolak@cisco.com>2019-08-06 11:02:02 +0000
commit7d7259ab1a065f0d1f849b29270514eacd3a1efe (patch)
tree872b5dd06071be44440bc0524b314cef4c3d3d82 /resources/libraries/python
parentfb3aba8bd6418418d9b3741839c4b305d8c72a4e (diff)
VPPD: Dot1Q
Change-Id: I0d3c925ea4a6896a0df98db6ddaf4238e6291bf1 Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/topology.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/resources/libraries/python/topology.py b/resources/libraries/python/topology.py
index b06cf7dc4e..394dc9df58 100644
--- a/resources/libraries/python/topology.py
+++ b/resources/libraries/python/topology.py
@@ -198,6 +198,19 @@ class Topology(object):
node['interfaces'][iface_key]['pci_address'] = str(pci_address)
@staticmethod
+ def update_interface_vlan(node, iface_key, vlan):
+ """Update VLAN on the interface from the node.
+
+ :param node: Node to update VLAN on.
+ :param iface_key: Topology key of the interface.
+ :param vlan: VLAN ID.
+ :type node: dict
+ :type iface_key: str
+ :type vlan: str
+ """
+ node['interfaces'][iface_key]['vlan'] = int(vlan)
+
+ @staticmethod
def update_interface_vhost_socket(node, iface_key, vhost_socket):
"""Update vhost socket name on the interface from the node.
@@ -696,6 +709,21 @@ class Topology(object):
return None
@staticmethod
+ def get_interface_vlan(node, iface_key):
+ """Get interface vlan.
+
+ :param node: Node to get interface driver on.
+ :param iface_key: Interface key from topology file.
+ :type node: dict
+ :type iface_key: str
+ :returns: Return interface vlan or None if not found.
+ """
+ try:
+ return node['interfaces'][iface_key].get('vlan')
+ except KeyError:
+ return None
+
+ @staticmethod
def get_node_interfaces(node):
"""Get all node interfaces.