summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-02-18 21:23:56 +0100
committerGitHub <noreply@github.com>2026-02-18 21:23:56 +0100
commitc386550aa8dd07026eba25bf40323c8d2439b6e2 (patch)
tree35ba1a7283d3438e69c8c703bc6a00b21b0ba394
parentd87b82578323a9fe9f2678e183f55492c7c7057c (diff)
parent32db496ac1cb54fc46ad42f924803fd89bf92c75 (diff)
downloadvyos-1x-c386550aa8dd07026eba25bf40323c8d2439b6e2.tar.gz
vyos-1x-c386550aa8dd07026eba25bf40323c8d2439b6e2.zip
Merge pull request #4961 from jvoss/srv6_encapsulation
srv6: T6977: add srv6 encapsulation source-address
-rw-r--r--data/templates/frr/zebra.segment_routing.frr.j227
-rw-r--r--interface-definitions/protocols_segment-routing.xml.in8
-rw-r--r--op-mode-definitions/show-segment-routing.xml.in6
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_segment-routing.py17
4 files changed, 49 insertions, 9 deletions
diff --git a/data/templates/frr/zebra.segment_routing.frr.j2 b/data/templates/frr/zebra.segment_routing.frr.j2
index 718d47d8f..a0bcc9210 100644
--- a/data/templates/frr/zebra.segment_routing.frr.j2
+++ b/data/templates/frr/zebra.segment_routing.frr.j2
@@ -1,23 +1,32 @@
!
-{% if srv6.locator is vyos_defined %}
+{% if srv6 is vyos_defined %}
segment-routing
srv6
+{% if srv6.encapsulation is vyos_defined %}
+ encapsulation
+{% if srv6.encapsulation.source_address is vyos_defined %}
+ source-address {{ srv6.encapsulation.source_address }}
+{% endif %}
+ exit
+{% endif %}
+{% if srv6.locator is vyos_defined %}
locators
-{% for locator, locator_config in srv6.locator.items() %}
+{% for locator, locator_config in srv6.locator.items() %}
locator {{ locator }}
-{% if locator_config.prefix is vyos_defined %}
+{% if locator_config.prefix is vyos_defined %}
prefix {{ locator_config.prefix }} block-len {{ locator_config.block_len }} node-len {{ locator_config.node_len }} func-bits {{ locator_config.func_bits }}
-{% endif %}
-{% if locator_config.behavior_usid is vyos_defined %}
+{% endif %}
+{% if locator_config.behavior_usid is vyos_defined %}
behavior usid
-{% endif %}
-{% if locator_config.format is vyos_defined %}
+{% endif %}
+{% if locator_config.format is vyos_defined %}
format {{ locator_config.format }}
-{% endif %}
+{% endif %}
exit
!
-{% endfor %}
+{% endfor %}
exit
+{% endif %}
!
exit
!
diff --git a/interface-definitions/protocols_segment-routing.xml.in b/interface-definitions/protocols_segment-routing.xml.in
index 075245936..32e61ebfc 100644
--- a/interface-definitions/protocols_segment-routing.xml.in
+++ b/interface-definitions/protocols_segment-routing.xml.in
@@ -61,6 +61,14 @@
<help>Segment-Routing SRv6 configuration</help>
</properties>
<children>
+ <node name="encapsulation">
+ <properties>
+ <help>Segment Routing SRv6 encapsulation</help>
+ </properties>
+ <children>
+ #include <include/source-address-ipv6.xml.i>
+ </children>
+ </node>
<tagNode name="locator">
<properties>
<help>Segment-Routing SRv6 locators configuration</help>
diff --git a/op-mode-definitions/show-segment-routing.xml.in b/op-mode-definitions/show-segment-routing.xml.in
index ebdb51a61..fc17e2f39 100644
--- a/op-mode-definitions/show-segment-routing.xml.in
+++ b/op-mode-definitions/show-segment-routing.xml.in
@@ -18,6 +18,12 @@
</properties>
<command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
</node>
+ <node name="manager">
+ <properties>
+ <help>Verify SRv6 manager</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </node>
</children>
</node>
</children>
diff --git a/smoketest/scripts/cli/test_protocols_segment-routing.py b/smoketest/scripts/cli/test_protocols_segment-routing.py
index a5c0d5983..85c25998c 100755
--- a/smoketest/scripts/cli/test_protocols_segment-routing.py
+++ b/smoketest/scripts/cli/test_protocols_segment-routing.py
@@ -158,6 +158,23 @@ class TestProtocolsSegmentRouting(VyOSUnitTestSHIM.TestCase):
if 'usid' in locator_config:
self.assertIn(' behavior usid', frrconfig)
+ def test_srv6_encap_source_addr(self):
+ # Set an IPv6 address for SRv6 encapsulation source
+ source6 = '2001:db8::1'
+
+ # SRv6 must be enabled on at least one interface
+ for interface in Section.interfaces('ethernet', vlan=False):
+ self.cli_set(base_path + ['interface', interface, 'srv6'])
+
+ self.cli_set(base_path + ['srv6', 'encapsulation', 'source-address', source6])
+ self.cli_commit()
+
+ frrconfig = self.getFRRconfig('segment-routing', stop_section='^exit')
+ self.assertIn('segment-routing', frrconfig)
+ self.assertIn(' srv6', frrconfig)
+ self.assertIn(' encapsulation', frrconfig)
+ self.assertIn(f' source-address {source6}', frrconfig)
+
def test_srv6_sysctl(self):
interfaces = Section.interfaces('ethernet', vlan=False)