X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FDhcp.py;h=2b4d03ec9e928a9628caaae31d4ee731afd9b5bd;hp=cd074c37028f7cf33fea9fe10b074a576b5e6587;hb=6da5a6920171682bd5bf6a77517bedfef91cbd0e;hpb=87c41b8df8b3c50a90e9d3d740ac629028109dc1 diff --git a/resources/libraries/python/Dhcp.py b/resources/libraries/python/Dhcp.py index cd074c3702..2b4d03ec9e 100644 --- a/resources/libraries/python/Dhcp.py +++ b/resources/libraries/python/Dhcp.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -14,10 +14,10 @@ """DHCP utilities for VPP.""" -from resources.libraries.python.VatExecutor import VatExecutor +from resources.libraries.python.PapiExecutor import PapiSocketExecutor -class DhcpProxy(object): +class DhcpProxy: """DHCP Proxy utilities.""" @staticmethod @@ -31,7 +31,11 @@ class DhcpProxy(object): :returns: DHCP relay data. :rtype: list """ + cmd = u"dhcp_proxy_dump" + args = dict(is_ip6=1 if ip_version == u"ipv6" else 0) + err_msg = f"Failed to get DHCP proxy dump on host {node[u'host']}" - return VatExecutor.cmd_from_template( - node, "dhcp_proxy_dump.vat", - ipv6="ipv6" if ip_version == "ipv6" else "") + with PapiSocketExecutor(node) as papi_exec: + details = papi_exec.add(cmd, **args).get_details(err_msg) + + return details