aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@gmail.com>2018-12-06 11:00:36 +0530
committerSusant Sahani <ssahani@gmail.com>2018-12-06 11:00:36 +0530
commitefecf9cd1544919ee061a4e13eaf1d2ec049bbcf (patch)
treebd3ae1239d375d4c11d67a6f08af7c258b3077df /test
parentnetworkd: RPDB rule - add support to configure inverted rule. (diff)
downloadsystemd-efecf9cd1544919ee061a4e13eaf1d2ec049bbcf.tar.gz
systemd-efecf9cd1544919ee061a4e13eaf1d2ec049bbcf.tar.bz2
systemd-efecf9cd1544919ee061a4e13eaf1d2ec049bbcf.zip
test-network: Add test for invert RPDB rule
Diffstat (limited to 'test')
-rw-r--r--test/test-network/conf/25-fibrule-invert.network10
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py15
2 files changed, 24 insertions, 1 deletions
diff --git a/test/test-network/conf/25-fibrule-invert.network b/test/test-network/conf/25-fibrule-invert.network
new file mode 100644
index 000000000..bcca0c27a
--- /dev/null
+++ b/test/test-network/conf/25-fibrule-invert.network
@@ -0,0 +1,10 @@
+[Match]
+Name=test1
+
+[RoutingPolicyRule]
+TypeOfService=0x08
+Table=7
+From= 192.168.100.18
+Priority=111
+IPProtocol = tcp
+InvertRule=true
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index aeedb6550..918eefa25 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -449,7 +449,7 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
units = ['12-dummy.netdev', 'test-static.network', 'configure-without-carrier.network', '11-dummy.netdev',
'23-primary-slave.network', '23-test1-bond199.network', '11-dummy.netdev', '23-bond199.network',
'25-bond-active-backup-slave.netdev', '12-dummy.netdev', '23-active-slave.network',
- 'routing-policy-rule.network', '25-fibrule-port-range.network', '25-address-section.network',
+ 'routing-policy-rule.network', '25-fibrule-port-range.network', '25-fibrule-invert.network', '25-address-section.network',
'25-address-section-miscellaneous.network', '25-route-section.network', '25-route-type.network',
'25-route-tcp-window-settings.network', '25-route-gateway.network', '25-route-gateway-on-link.network',
'25-address-link-section.network', '25-ipv6-address-label-section.network', '25-link-section-unmanaged.network',
@@ -532,6 +532,19 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'tcp')
self.assertRegex(output, 'lookup 7')
+ def test_routing_policy_rule_invert(self):
+ self.copy_unit_to_networkd_unit_path('25-fibrule-invert.network', '11-dummy.netdev')
+ self.start_networkd()
+
+ self.assertTrue(self.link_exits('test1'))
+ output = subprocess.check_output(['ip', 'rule']).rstrip().decode('utf-8')
+ print(output)
+
+ self.assertRegex(output, '111')
+ self.assertRegex(output, 'not.*?from.*?192.168.100.18')
+ self.assertRegex(output, 'tcp')
+ self.assertRegex(output, 'lookup 7')
+
def test_address_preferred_lifetime_zero_ipv6(self):
self.copy_unit_to_networkd_unit_path('25-address-section-miscellaneous.network', '12-dummy.netdev')
self.start_networkd()