summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_service_dhcpv6-relay.py
diff options
context:
space:
mode:
Diffstat (limited to 'smoketest/scripts/cli/test_service_dhcpv6-relay.py')
-rwxr-xr-xsmoketest/scripts/cli/test_service_dhcpv6-relay.py31
1 files changed, 14 insertions, 17 deletions
diff --git a/smoketest/scripts/cli/test_service_dhcpv6-relay.py b/smoketest/scripts/cli/test_service_dhcpv6-relay.py
index e36c237bc..5a9dd1aa6 100755
--- a/smoketest/scripts/cli/test_service_dhcpv6-relay.py
+++ b/smoketest/scripts/cli/test_service_dhcpv6-relay.py
@@ -14,15 +14,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import re
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.ifconfig import Section
from vyos.template import address_from_cidr
-from vyos.util import cmd
from vyos.util import process_named_running
from vyos.util import read_file
@@ -35,52 +34,50 @@ upstream_if_addr = '2001:db8::1/64'
listen_addr = '2001:db8:ffff::1/64'
interfaces = []
-class TestServiceDHCPv6Relay(unittest.TestCase):
+class TestServiceDHCPv6Relay(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
for tmp in interfaces:
listen = listen_addr
if tmp == upstream_if:
listen = upstream_if_addr
- self.session.set(['interfaces', 'ethernet', tmp, 'address', listen])
+ self.cli_set(['interfaces', 'ethernet', tmp, 'address', listen])
def tearDown(self):
- self.session.delete(base_path)
+ self.cli_delete(base_path)
for tmp in interfaces:
listen = listen_addr
if tmp == upstream_if:
listen = upstream_if_addr
- self.session.delete(['interfaces', 'ethernet', tmp, 'address', listen])
+ self.cli_delete(['interfaces', 'ethernet', tmp, 'address', listen])
- self.session.commit()
- del self.session
+ self.cli_commit()
def test_relay_default(self):
dhcpv6_server = '2001:db8::ffff'
hop_count = '20'
- self.session.set(base_path + ['use-interface-id-option'])
- self.session.set(base_path + ['max-hop-count', hop_count])
+ self.cli_set(base_path + ['use-interface-id-option'])
+ self.cli_set(base_path + ['max-hop-count', hop_count])
# check validate() - Must set at least one listen and upstream
# interface addresses.
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + ['upstream-interface', upstream_if, 'address', dhcpv6_server])
+ self.cli_commit()
+ self.cli_set(base_path + ['upstream-interface', upstream_if, 'address', dhcpv6_server])
# check validate() - Must set at least one listen and upstream
# interface addresses.
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
# add listener on all ethernet interfaces except the upstream interface
for tmp in interfaces:
if tmp == upstream_if:
continue
- self.session.set(base_path + ['listen-interface', tmp, 'address', listen_addr.split('/')[0]])
+ self.cli_set(base_path + ['listen-interface', tmp, 'address', listen_addr.split('/')[0]])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check configured port
config = read_file(RELAY_CONF)