Merge branch 'main' of github.com:pimvanpelt/vppcfg into main
This commit is contained in:
1
setup.py
1
setup.py
@ -9,7 +9,6 @@ setup(
|
||||
'importlib-metadata; python_version == "3.8"',
|
||||
"yamale",
|
||||
"netaddr",
|
||||
"ipaddress",
|
||||
"vpp_papi",
|
||||
],
|
||||
packages=["vppcfg", "vppcfg/config", "vppcfg/vpp"],
|
||||
|
@ -30,7 +30,7 @@ class Applier(VPPApi):
|
||||
def __init__(
|
||||
self,
|
||||
vpp_api_socket="/run/vpp/api.sock",
|
||||
vpp_json_dir="/usr/share/vpp/api/",
|
||||
vpp_json_dir=None,
|
||||
clientname="vppcfg",
|
||||
):
|
||||
VPPApi.__init__(self, vpp_api_socket, vpp_json_dir, clientname)
|
||||
|
@ -34,7 +34,7 @@ class Dumper(VPPApi):
|
||||
def __init__(
|
||||
self,
|
||||
vpp_api_socket="/run/vpp/api.sock",
|
||||
vpp_json_dir="/usr/share/vpp/api/",
|
||||
vpp_json_dir=None,
|
||||
clientname="vppcfg",
|
||||
):
|
||||
VPPApi.__init__(self, vpp_api_socket, vpp_json_dir, clientname)
|
||||
|
@ -42,7 +42,7 @@ class Reconciler:
|
||||
self,
|
||||
cfg,
|
||||
vpp_api_socket="/run/vpp/api.sock",
|
||||
vpp_json_dir="/usr/share/vpp/api/",
|
||||
vpp_json_dir=None,
|
||||
):
|
||||
self.logger = logging.getLogger("vppcfg.reconciler")
|
||||
self.logger.addHandler(logging.NullHandler())
|
||||
|
@ -23,7 +23,7 @@ import fnmatch
|
||||
import logging
|
||||
import socket
|
||||
import time
|
||||
from vpp_papi import VPPApiClient
|
||||
from vpp_papi import VPPApiClient, VPPApiJSONFiles
|
||||
|
||||
|
||||
class VPPApi:
|
||||
@ -32,12 +32,15 @@ class VPPApi:
|
||||
def __init__(
|
||||
self,
|
||||
vpp_api_socket="/run/vpp/api.sock",
|
||||
vpp_json_dir="/usr/share/vpp/api/",
|
||||
vpp_json_dir=None,
|
||||
clientname="vppcfg",
|
||||
):
|
||||
self.logger = logging.getLogger("vppcfg.vppapi")
|
||||
self.logger.addHandler(logging.NullHandler())
|
||||
|
||||
if vpp_json_dir is None:
|
||||
vpp_json_dir = VPPApiJSONFiles.find_api_dir([])
|
||||
|
||||
if not os.path.exists(vpp_api_socket):
|
||||
self.logger.error(f"VPP api socket file not found: {vpp_api_socket}")
|
||||
if not os.path.isdir(vpp_json_dir):
|
||||
@ -58,11 +61,7 @@ class VPPApi:
|
||||
return True
|
||||
|
||||
# construct a list of all the json api files
|
||||
jsonfiles = []
|
||||
for root, _dirnames, filenames in os.walk(self.vpp_json_dir):
|
||||
for filename in fnmatch.filter(filenames, "*.api.json"):
|
||||
jsonfiles.append(os.path.join(root, filename))
|
||||
|
||||
jsonfiles = VPPApiJSONFiles.find_api_files(api_dir=self.vpp_json_dir)
|
||||
if not jsonfiles:
|
||||
self.logger.error("no json api files found")
|
||||
return False
|
||||
|
Reference in New Issue
Block a user