summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface-definitions/include/qos/bandwidth-auto.xml.i4
-rw-r--r--interface-definitions/include/qos/match-dscp.xml.i44
-rw-r--r--interface-definitions/include/qos/set-dscp.xml.i84
-rw-r--r--python/vyos/configdiff.py31
-rwxr-xr-xsrc/conf_mode/qos.py3
-rwxr-xr-xsrc/op_mode/nat.py12
6 files changed, 136 insertions, 42 deletions
diff --git a/interface-definitions/include/qos/bandwidth-auto.xml.i b/interface-definitions/include/qos/bandwidth-auto.xml.i
index 3780b7444..260bd4f7b 100644
--- a/interface-definitions/include/qos/bandwidth-auto.xml.i
+++ b/interface-definitions/include/qos/bandwidth-auto.xml.i
@@ -7,7 +7,7 @@
</completionHelp>
<valueHelp>
<format>auto</format>
- <description>Rate matches interface speed</description>
+ <description>Bandwidth matches interface speed</description>
</valueHelp>
<valueHelp>
<format>&lt;number&gt;</format>
@@ -35,7 +35,7 @@
</valueHelp>
<constraint>
<validator name="numeric" argument="--positive"/>
- <regex>\d+(bit|kbit|mbit|gbit|tbit)</regex>
+ <regex>(auto|\d+(bit|kbit|mbit|gbit|tbit))</regex>
</constraint>
</properties>
<defaultValue>auto</defaultValue>
diff --git a/interface-definitions/include/qos/match-dscp.xml.i b/interface-definitions/include/qos/match-dscp.xml.i
index 1323fc033..2d2fd0a57 100644
--- a/interface-definitions/include/qos/match-dscp.xml.i
+++ b/interface-definitions/include/qos/match-dscp.xml.i
@@ -3,7 +3,7 @@
<properties>
<help>Match on Differentiated Services Codepoint (DSCP)</help>
<completionHelp>
- <list>default reliability throughput lowdelay priority immediate flash flash-override critical internet network af11 af12 af13 af21 af22 af23 af31 af32 af33 af41 af42 af43 cs1 cs2 cs3 cs4 cs5 cs6 cs7 ef</list>
+ <list>default reliability throughput lowdelay priority immediate flash flash-override critical internet network AF11 AF12 AF13 AF21 AF22 AF23 AF31 AF32 AF33 AF41 AF42 AF43 CS1 CS2 CS3 CS4 CS5 CS6 CS7 EF</list>
</completionHelp>
<valueHelp>
<format>u32:0-63</format>
@@ -54,88 +54,88 @@
<description>match DSCP (111000)</description>
</valueHelp>
<valueHelp>
- <format>af11</format>
+ <format>AF11</format>
<description>High-throughput data</description>
</valueHelp>
<valueHelp>
- <format>af12</format>
+ <format>AF12</format>
<description>High-throughput data</description>
</valueHelp>
<valueHelp>
- <format>af13</format>
+ <format>AF13</format>
<description>High-throughput data</description>
</valueHelp>
<valueHelp>
- <format>af21</format>
+ <format>AF21</format>
<description>Low-latency data</description>
</valueHelp>
<valueHelp>
- <format>af22</format>
+ <format>AF22</format>
<description>Low-latency data</description>
</valueHelp>
<valueHelp>
- <format>af23</format>
+ <format>AF23</format>
<description>Low-latency data</description>
</valueHelp>
<valueHelp>
- <format>af31</format>
+ <format>AF31</format>
<description>Multimedia streaming</description>
</valueHelp>
<valueHelp>
- <format>af32</format>
+ <format>AF32</format>
<description>Multimedia streaming</description>
</valueHelp>
<valueHelp>
- <format>af33</format>
+ <format>AF33</format>
<description>Multimedia streaming</description>
</valueHelp>
<valueHelp>
- <format>af41</format>
+ <format>AF41</format>
<description>Multimedia conferencing</description>
</valueHelp>
<valueHelp>
- <format>af42</format>
+ <format>AF42</format>
<description>Multimedia conferencing</description>
</valueHelp>
<valueHelp>
- <format>af43</format>
+ <format>AF43</format>
<description>Multimedia conferencing</description>
</valueHelp>
<valueHelp>
- <format>cs1</format>
+ <format>CS1</format>
<description>Low-priority data</description>
</valueHelp>
<valueHelp>
- <format>cs2</format>
+ <format>CS2</format>
<description>OAM</description>
</valueHelp>
<valueHelp>
- <format>cs3</format>
+ <format>CS3</format>
<description>Broadcast video</description>
</valueHelp>
<valueHelp>
- <format>cs4</format>
+ <format>CS4</format>
<description>Real-time interactive</description>
</valueHelp>
<valueHelp>
- <format>cs5</format>
+ <format>CS5</format>
<description>Signaling</description>
</valueHelp>
<valueHelp>
- <format>cs6</format>
+ <format>CS6</format>
<description>Network control</description>
</valueHelp>
<valueHelp>
- <format>cs7</format>
+ <format>CS7</format>
<description></description>
</valueHelp>
<valueHelp>
- <format>ef</format>
+ <format>EF</format>
<description>Expedited Forwarding</description>
</valueHelp>
<constraint>
<validator name="numeric" argument="--range 0-63"/>
- <regex>(default|reliability|throughput|lowdelay|priority|immediate|flash|flash-override|critical|internet|network|af11|af12|af13|af21|af22|af23|af31|af32|af33|af41|af42|af43|cs1|cs2|cs3|cs4|cs5|cs6|cs7|ef)</regex>
+ <regex>(default|reliability|throughput|lowdelay|priority|immediate|flash|flash-override|critical|internet|network|AF11|AF12|AF13|AF21|AF22|AF23|AF31|AF32|AF33|AF41|AF42|AF43|CS1|CS2|CS3|CS4|CS5|CS6|CS7|EF)</regex>
</constraint>
</properties>
</leafNode>
diff --git a/interface-definitions/include/qos/set-dscp.xml.i b/interface-definitions/include/qos/set-dscp.xml.i
index 55c0ea44d..07f33783f 100644
--- a/interface-definitions/include/qos/set-dscp.xml.i
+++ b/interface-definitions/include/qos/set-dscp.xml.i
@@ -3,7 +3,7 @@
<properties>
<help>Change the Differentiated Services (DiffServ) field in the IP header</help>
<completionHelp>
- <list>default reliability throughput lowdelay priority immediate flash flash-override critical internet network</list>
+ <list>default reliability throughput lowdelay priority immediate flash flash-override critical internet network AF11 AF12 AF13 AF21 AF22 AF23 AF31 AF32 AF33 AF41 AF42 AF43 CS1 CS2 CS3 CS4 CS5 CS6 CS7 EF</list>
</completionHelp>
<valueHelp>
<format>u32:0-63</format>
@@ -53,9 +53,89 @@
<format>network</format>
<description>match DSCP (111000)</description>
</valueHelp>
+ <valueHelp>
+ <format>AF11</format>
+ <description>High-throughput data</description>
+ </valueHelp>
+ <valueHelp>
+ <format>AF12</format>
+ <description>High-throughput data</description>
+ </valueHelp>
+ <valueHelp>
+ <format>AF13</format>
+ <description>High-throughput data</description>
+ </valueHelp>
+ <valueHelp>
+ <format>AF21</format>
+ <description>Low-latency data</description>
+ </valueHelp>
+ <valueHelp>
+ <format>AF22</format>
+ <description>Low-latency data</description>
+ </valueHelp>
+ <valueHelp>
+ <format>AF23</format>
+ <description>Low-latency data</description>
+ </valueHelp>
+ <valueHelp>
+ <format>AF31</format>
+ <description>Multimedia streaming</description>
+ </valueHelp>
+ <valueHelp>
+ <format>AF32</format>
+ <description>Multimedia streaming</description>
+ </valueHelp>
+ <valueHelp>
+ <format>AF33</format>
+ <description>Multimedia streaming</description>
+ </valueHelp>
+ <valueHelp>
+ <format>AF41</format>
+ <description>Multimedia conferencing</description>
+ </valueHelp>
+ <valueHelp>
+ <format>AF42</format>
+ <description>Multimedia conferencing</description>
+ </valueHelp>
+ <valueHelp>
+ <format>AF43</format>
+ <description>Multimedia conferencing</description>
+ </valueHelp>
+ <valueHelp>
+ <format>CS1</format>
+ <description>Low-priority data</description>
+ </valueHelp>
+ <valueHelp>
+ <format>CS2</format>
+ <description>OAM</description>
+ </valueHelp>
+ <valueHelp>
+ <format>CS3</format>
+ <description>Broadcast video</description>
+ </valueHelp>
+ <valueHelp>
+ <format>CS4</format>
+ <description>Real-time interactive</description>
+ </valueHelp>
+ <valueHelp>
+ <format>CS5</format>
+ <description>Signaling</description>
+ </valueHelp>
+ <valueHelp>
+ <format>CS6</format>
+ <description>Network control</description>
+ </valueHelp>
+ <valueHelp>
+ <format>CS7</format>
+ <description></description>
+ </valueHelp>
+ <valueHelp>
+ <format>EF</format>
+ <description>Expedited Forwarding</description>
+ </valueHelp>
<constraint>
<validator name="numeric" argument="--range 0-63"/>
- <regex>(default|reliability|throughput|lowdelay|priority|immediate|flash|flash-override|critical|internet|network)</regex>
+ <regex>(default|reliability|throughput|lowdelay|priority|immediate|flash|flash-override|critical|internet|network|AF11|AF12|AF13|AF21|AF22|AF23|AF31|AF32|AF33|AF41|AF42|AF43|CS1|CS2|CS3|CS4|CS5|CS6|CS7|EF)</regex>
</constraint>
<constraintErrorMessage>Priority must be between 0 and 63</constraintErrorMessage>
</properties>
diff --git a/python/vyos/configdiff.py b/python/vyos/configdiff.py
index 9185575df..ac86af09c 100644
--- a/python/vyos/configdiff.py
+++ b/python/vyos/configdiff.py
@@ -78,23 +78,34 @@ def get_config_diff(config, key_mangling=None):
isinstance(key_mangling[1], str)):
raise ValueError("key_mangling must be a tuple of two strings")
- diff_t = DiffTree(config._running_config, config._session_config)
+ if hasattr(config, 'cached_diff_tree'):
+ diff_t = getattr(config, 'cached_diff_tree')
+ else:
+ diff_t = DiffTree(config._running_config, config._session_config)
+ setattr(config, 'cached_diff_tree', diff_t)
- return ConfigDiff(config, key_mangling, diff_tree=diff_t)
+ if hasattr(config, 'cached_diff_dict'):
+ diff_d = getattr(config, 'cached_diff_dict')
+ else:
+ diff_d = diff_t.dict
+ setattr(config, 'cached_diff_dict', diff_d)
+
+ return ConfigDiff(config, key_mangling, diff_tree=diff_t,
+ diff_dict=diff_d)
class ConfigDiff(object):
"""
The class of config changes as represented by comparison between the
session config dict and the effective config dict.
"""
- def __init__(self, config, key_mangling=None, diff_tree=None):
+ def __init__(self, config, key_mangling=None, diff_tree=None, diff_dict=None):
self._level = config.get_level()
self._session_config_dict = config.get_cached_root_dict(effective=False)
self._effective_config_dict = config.get_cached_root_dict(effective=True)
self._key_mangling = key_mangling
self._diff_tree = diff_tree
- self._diff_dict = diff_tree.dict if diff_tree else {}
+ self._diff_dict = diff_dict
# mirrored from Config; allow path arguments relative to level
def _make_path(self, path):
@@ -209,9 +220,9 @@ class ConfigDiff(object):
if self._diff_tree is None:
raise NotImplementedError("diff_tree class not available")
else:
- add = get_sub_dict(self._diff_tree.dict, ['add'], get_first_key=True)
- sub = get_sub_dict(self._diff_tree.dict, ['sub'], get_first_key=True)
- inter = get_sub_dict(self._diff_tree.dict, ['inter'], get_first_key=True)
+ add = get_sub_dict(self._diff_dict, ['add'], get_first_key=True)
+ sub = get_sub_dict(self._diff_dict, ['sub'], get_first_key=True)
+ inter = get_sub_dict(self._diff_dict, ['inter'], get_first_key=True)
ret = {}
ret[enum_to_key(Diff.MERGE)] = session_dict
ret[enum_to_key(Diff.DELETE)] = get_sub_dict(sub, self._make_path(path),
@@ -284,9 +295,9 @@ class ConfigDiff(object):
if self._diff_tree is None:
raise NotImplementedError("diff_tree class not available")
else:
- add = get_sub_dict(self._diff_tree.dict, ['add'], get_first_key=True)
- sub = get_sub_dict(self._diff_tree.dict, ['sub'], get_first_key=True)
- inter = get_sub_dict(self._diff_tree.dict, ['inter'], get_first_key=True)
+ add = get_sub_dict(self._diff_dict, ['add'], get_first_key=True)
+ sub = get_sub_dict(self._diff_dict, ['sub'], get_first_key=True)
+ inter = get_sub_dict(self._diff_dict, ['inter'], get_first_key=True)
ret = {}
ret[enum_to_key(Diff.MERGE)] = session_dict
ret[enum_to_key(Diff.DELETE)] = get_sub_dict(sub, self._make_path(path))
diff --git a/src/conf_mode/qos.py b/src/conf_mode/qos.py
index 7e94e95bf..2eb03237c 100755
--- a/src/conf_mode/qos.py
+++ b/src/conf_mode/qos.py
@@ -139,9 +139,6 @@ def get_config(config=None):
qos['policy'][policy][p_name]['precedence'][precedence]['queue_limit'] = \
str(int(4 * max_thr))
- import pprint
- pprint.pprint(qos)
-
return qos
def verify(qos):
diff --git a/src/op_mode/nat.py b/src/op_mode/nat.py
index a46571bd5..cf06de0e9 100755
--- a/src/op_mode/nat.py
+++ b/src/op_mode/nat.py
@@ -316,14 +316,20 @@ def show_statistics(raw: bool, direction: str, family: str):
@_verify
-def show_translations(raw: bool, direction: str, family: str, address: typing.Optional[str]):
+def show_translations(raw: bool, direction:
+ str, family: str,
+ address: typing.Optional[str],
+ verbose: typing.Optional[bool]):
family = 'ipv6' if family == 'inet6' else 'ipv4'
- nat_translation = _get_raw_translation(direction, family=family, address=address)
+ nat_translation = _get_raw_translation(direction,
+ family=family,
+ address=address)
if raw:
return nat_translation
else:
- return _get_formatted_translation(nat_translation, direction, family, verbose)
+ return _get_formatted_translation(nat_translation, direction, family,
+ verbose)
if __name__ == '__main__':