Cosmetic rename instance of config/validator class

This commit is contained in:
Pim van Pelt
2022-03-24 14:00:05 +00:00
parent 672dd65f11
commit cfcbec239c
2 changed files with 4 additions and 8 deletions

View File

@ -142,7 +142,3 @@ class Validator(object):
self.logger.info("Configuration validated successfully") self.logger.info("Configuration validated successfully")
return True return True
def get_phys(self, yaml):
""" Return all PHYs in the config """
return interface.get_phys(yaml)

8
vppcfg
View File

@ -18,6 +18,7 @@ import sys
import yaml import yaml
import logging import logging
from config import Validator from config import Validator
import config.interface as interface
from vpp.vppapi import VPPApi from vpp.vppapi import VPPApi
try: try:
@ -52,15 +53,14 @@ def main():
logging.error("Couldn't read config from %s" % args.config) logging.error("Couldn't read config from %s" % args.config)
sys.exit(-1) sys.exit(-1)
config = Validator(schema=args.schema) v = Validator(schema=args.schema)
if not config.valid_config(cfg): if not v.valid_config(cfg):
logging.error("Configuration is not valid, bailing") logging.error("Configuration is not valid, bailing")
sys.exit(-2) sys.exit(-2)
config_phys = config.get_phys(cfg)
vpp = VPPApi() vpp = VPPApi()
vpp.readconfig() vpp.readconfig()
if not vpp.phys_exist(config_phys): if not vpp.phys_exist(interface.get_phys(cfg)):
logging.error("Not all PHYs in the config exist in VPP") logging.error("Not all PHYs in the config exist in VPP")
vpp.disconnect() vpp.disconnect()
sys.exit(-3) sys.exit(-3)