Example #1
0
class Loader(object):
    """Loader class - main object context holder.
    """
    _vswitch_loader = None

    def __init__(self):
        """Loader ctor - initialization method.

        All data is read from configuration each time Loader instance is
        created. It is up to creator to maintain object life cycle if this
        behavior is unwanted.
        """
        self._vswitch_loader = LoaderServant(
            settings.getValue('VSWITCH_DIR'),
            settings.getValue('VSWITCH'),
            IVSwitch)

    def get_vswitch(self):
        """Returns instance of currently configured vswitch implementation.

        :return: IVSwitch implementation if available, None otherwise.
        """
        return self._vswitch_loader.get_class()()

    def get_vswitch_class(self):
        """Returns type of currently configured vswitch implementation.

        :return: Type of IVSwitch implementation if available.
            None otherwise.
        """
        return self._vswitch_loader.get_class()

    def get_vswitches(self):
        """Returns dictionary of all available vswitches.

        :return: Dictionary of vswitches.
            - key: name of the class which implements IVSwitch,
            - value: Type of vswitch which implements IVSwitch.
        """
        return self._vswitch_loader.get_classes()

    def get_vswitches_printable(self):
        """Returns all available vswitches in printable format.

        :return: String containing printable list of vswitches.
        """
        return self._vswitch_loader.get_classes_printable()
Example #2
0
class Loader():
    """Loader class - main object context holder.
    """
    _k8scontroller_loader = None

    def __init__(self):
        """Loader ctor - initialization method.

        All data is read from configuration each time Loader instance is
        created. It is up to creator to maintain object life cycle if this
        behavior is unwanted.
        """
        self._k8scontroller_loader = LoaderServant(
            settings.getValue('K8S_CONTROL_DIR'),
            settings.getValue('K8S_CONTROLLER'),
            IK8sController)

    def get_k8scontroller(self):
        """ Returns a new instance configured Kubernetes Controller
        :return: Ik8scontroller implementation if available, None otherwise
        """
        return self._k8scontroller_loader.get_class()()

    def get_k8scontroller_class(self):
        """Returns type of currently configured Kubernetes Controller

        :return: Type of Ik8scontroller implementation if available.
            None otherwise.
        """
        return self._k8scontroller_loader.get_class()

    def get_k8scontrollers(self):
        """
        Get K8S Controllers
        """
        return self._k8scontroller_loader.get_classes()

    def get_k8scontrollers_printable(self):
        """
        Get K8S Controllers for printing
        """
        return self._k8scontroller_loader.get_classes_printable()
Example #3
0
class Loader(object):
    """Loader class - main object context holder.
    """
    _trafficgen_loader = None
    _metrics_loader = None
    _vswitch_loader = None
    _vnf_loader = None
    _loadgen_loader = None

    def __init__(self):
        """Loader ctor - initialization method.

        All data is read from configuration each time Loader instance is
        created. It is up to creator to maintain object life cycle if this
        behavior is unwanted.
        """
        self._trafficgen_loader = LoaderServant(
            settings.getValue('TRAFFICGEN_DIR'),
            settings.getValue('TRAFFICGEN'),
            ITrafficGenerator)

        self._metrics_loader = LoaderServant(
            settings.getValue('COLLECTOR_DIR'),
            settings.getValue('COLLECTOR'),
            ICollector)

        self._loadgen_loader = LoaderServant(
            settings.getValue('LOADGEN_DIR'),
            settings.getValue('LOADGEN'),
            ILoadGenerator)

        self._vswitch_loader = LoaderServant(
            settings.getValue('VSWITCH_DIR'),
            settings.getValue('VSWITCH'),
            IVSwitch)

        self._vnf_loader = LoaderServant(
            settings.getValue('VNF_DIR'),
            settings.getValue('VNF'),
            IVnf)

        self._pktfwd_loader = LoaderServant(
            settings.getValue('PKTFWD_DIR'),
            settings.getValue('PKTFWD'),
            IPktFwd)

        self._pod_loader = LoaderServant(
            settings.getValue('POD_DIR'),
            settings.getValue('POD'),
            IPod)

    def get_trafficgen(self):
        """Returns a new instance configured traffic generator.

        :return: ITrafficGenerator implementation if available, None otherwise.
        """
        return self._trafficgen_loader.get_class()()

    def get_trafficgen_class(self):
        """Returns type of currently configured traffic generator.

        :return: Type of ITrafficGenerator implementation if available.
            None otherwise.
        """
        return self._trafficgen_loader.get_class()

    def get_trafficgens(self):
        """Returns dictionary of all available traffic generators.

        :return: Dictionary of traffic generators.
            - key: name of the class which implements ITrafficGenerator,
            - value: Type of traffic generator which implements
              ITrafficGenerator.
        """
        return self._trafficgen_loader.get_classes()

    def get_trafficgens_printable(self):
        """Returns all available traffic generators in printable format.

        :return: String containing printable list of traffic generators.
        """
        return self._trafficgen_loader.get_classes_printable()

    def get_collector(self):
        """Returns instance of currently configured collector implementation.

        :return: ICollector implementation if available, None otherwise.
        """
        return self._metrics_loader.get_class()()

    def get_collector_class(self):
        """Returns type of currently configured collector implementation.

        :return: Type of ICollector implementation if available.
            None otherwise.
        """
        return self._metrics_loader.get_class()

    def get_collectors(self):
        """Returns dictionary of all available collectors.

        :return: Dictionary of collectors.
            - key: name of the class which implements ICollector,
            - value: Type of collector which implements ICollector.
        """
        return self._metrics_loader.get_classes()

    def get_collectors_printable(self):
        """Returns all available collectors in printable format.

        :return: String containing printable list of collectors.
        """
        return self._metrics_loader.get_classes_printable()

    def get_loadgen_class(self):
        """Returns type of currently configured loadgen implementation.

        :return: Type of ILoadGenerator implementation if available.
            None otherwise.
        """
        return self._loadgen_loader.get_class()

    def get_loadgens(self):
        """Returns dictionary of all available loadgens

        :return: Dictionary of loadgens
            - key: name of the class which implements ILoadGenerator
            - value: Type of class which implements ILoadGenerator
        """
        return self._loadgen_loader.get_classes()

    def get_loadgens_printable(self):
        """Returns all available loadgens in printable format

        :return: String containing printable list of loadgens
        """
        return self._loadgen_loader.get_classes_printable()

    def get_vswitch(self):
        """Returns instance of currently configured vswitch implementation.

        :return: IVSwitch implementation if available, None otherwise.
        """
        return self._vswitch_loader.get_class()()

    def get_vswitch_class(self):
        """Returns type of currently configured vswitch implementation.

        :return: Type of IVSwitch implementation if available.
            None otherwise.
        """
        return self._vswitch_loader.get_class()

    def get_vswitches(self):
        """Returns dictionary of all available vswitches.

        :return: Dictionary of vswitches.
            - key: name of the class which implements IVSwitch,
            - value: Type of vswitch which implements IVSwitch.
        """
        return self._vswitch_loader.get_classes()

    def get_vswitches_printable(self):
        """Returns all available vswitches in printable format.

        :return: String containing printable list of vswitches.
        """
        return self._vswitch_loader.get_classes_printable()

    def get_vnf(self):
        """Returns instance of currently configured vnf implementation.

        :return: IVnf implementation if available, None otherwise.
        """
        return self._vnf_loader.get_class()()

    def get_vnf_class(self):
        """Returns type of currently configured vnf implementation.

        :return: Type of IVnf implementation if available.
            None otherwise.
        """
        return self._vnf_loader.get_class()

    def get_vnfs(self):
        """Returns dictionary of all available vnfs.

        :return: Dictionary of vnfs.
            - key: name of the class which implements IVnf,
            - value: Type of vnf which implements IVnf.
        """
        return self._vnf_loader.get_classes()

    def get_vnfs_printable(self):
        """Returns all available vnfs in printable format.

        :return: String containing printable list of vnfs.
        """
        return self._vnf_loader.get_classes_printable()

    def get_pod(self):
        """Returns instance of currently configured pod implementation.

        :return: IPod implementation if available, None otherwise.
        """
        return self._pod_loader.get_class()()

    def get_pod_class(self):
        """Returns type of currently configured pod implementation.

        :return: Type of IPod implementation if available.
            None otherwise.
        """
        return self._pod_loader.get_class()

    def get_pods(self):
        """Returns dictionary of all available pods.

        :return: Dictionary of pods.
            - key: name of the class which implements IPod,
            - value: Type of vnf which implements IPod.
        """
        return self._pod_loader.get_classes()

    def get_pods_printable(self):
        """Returns all available pods in printable format.

        :return: String containing printable list of pods.
        """
        return self._pod_loader.get_classes_printable()

    def get_pktfwd(self):
        """Returns instance of currently configured packet forwarder implementation.

        :return: IPktFwd implementation if available, None otherwise.
        """
        return self._pktfwd_loader.get_class()()

    def get_pktfwd_class(self):
        """Returns type of currently configured packet forwarder implementation.

        :return: Type of IPktFwd implementation if available.
            None otherwise.
        """
        return self._pktfwd_loader.get_class()

    def get_pktfwds(self):
        """Returns dictionary of all available packet forwarders.

        :return: Dictionary of packet forwarders.
            - key: name of the class which implements IPktFwd,
            - value: Type of packet forwarder which implements IPktFwd.
        """
        return self._pktfwd_loader.get_classes()

    def get_pktfwds_printable(self):
        """Returns all available packet forwarders in printable format.

        :return: String containing printable list of packet forwarders.
        """
        return self._pktfwd_loader.get_classes_printable()
Example #4
0
class Loader(object):
    """Loader class - main object context holder.
    """
    _trafficgen_loader = None
    _metrics_loader = None
    _vswitch_loader = None
    _vnf_loader = None

    def __init__(self):
        """Loader ctor - initialization method.

        All data is read from configuration each time Loader instance is
        created. It is up to creator to maintain object life cycle if this
        behavior is unwanted.
        """
        self._trafficgen_loader = LoaderServant(
            settings.getValue('TRAFFICGEN_DIR'),
            settings.getValue('TRAFFICGEN'),
            ITrafficGenerator)

        self._metrics_loader = LoaderServant(
            settings.getValue('COLLECTOR_DIR'),
            settings.getValue('COLLECTOR'),
            ICollector)

        self._vswitch_loader = LoaderServant(
            settings.getValue('VSWITCH_DIR'),
            settings.getValue('VSWITCH'),
            IVSwitch)

        self._vnf_loader = LoaderServant(
            settings.getValue('VNF_DIR'),
            settings.getValue('VNF'),
            IVnf)

        self._pktfwd_loader = LoaderServant(
            settings.getValue('PKTFWD_DIR'),
            settings.getValue('PKTFWD'),
            IPktFwd)

    def get_trafficgen(self):
        """Returns a new instance configured traffic generator.

        :return: ITrafficGenerator implementation if available, None otherwise.
        """
        return self._trafficgen_loader.get_class()()

    def get_trafficgen_class(self):
        """Returns type of currently configured traffic generator.

        :return: Type of ITrafficGenerator implementation if available.
            None otherwise.
        """
        return self._trafficgen_loader.get_class()

    def get_trafficgens(self):
        """Returns dictionary of all available traffic generators.

        :return: Dictionary of traffic generators.
            - key: name of the class which implements ITrafficGenerator,
            - value: Type of traffic generator which implements
              ITrafficGenerator.
        """
        return self._trafficgen_loader.get_classes()

    def get_trafficgens_printable(self):
        """Returns all available traffic generators in printable format.

        :return: String containing printable list of traffic generators.
        """
        return self._trafficgen_loader.get_classes_printable()

    def get_collector(self):
        """Returns instance of currently configured collector implementation.

        :return: ICollector implementation if available, None otherwise.
        """
        return self._metrics_loader.get_class()()

    def get_collector_class(self):
        """Returns type of currently configured collector implementation.

        :return: Type of ICollector implementation if available.
            None otherwise.
        """
        return self._metrics_loader.get_class()

    def get_collectors(self):
        """Returns dictionary of all available collectors.

        :return: Dictionary of collectors.
            - key: name of the class which implements ICollector,
            - value: Type of collector which implements ICollector.
        """
        return self._metrics_loader.get_classes()

    def get_collectors_printable(self):
        """Returns all available collectors in printable format.

        :return: String containing printable list of collectors.
        """
        return self._metrics_loader.get_classes_printable()

    def get_vswitch(self):
        """Returns instance of currently configured vswitch implementation.

        :return: IVSwitch implementation if available, None otherwise.
        """
        return self._vswitch_loader.get_class()()

    def get_vswitch_class(self):
        """Returns type of currently configured vswitch implementation.

        :return: Type of IVSwitch implementation if available.
            None otherwise.
        """
        return self._vswitch_loader.get_class()

    def get_vswitches(self):
        """Returns dictionary of all available vswitches.

        :return: Dictionary of vswitches.
            - key: name of the class which implements IVSwitch,
            - value: Type of vswitch which implements IVSwitch.
        """
        return self._vswitch_loader.get_classes()

    def get_vswitches_printable(self):
        """Returns all available vswitches in printable format.

        :return: String containing printable list of vswitches.
        """
        return self._vswitch_loader.get_classes_printable()

    def get_vnf(self):
        """Returns instance of currently configured vnf implementation.

        :return: IVnf implementation if available, None otherwise.
        """
        return self._vnf_loader.get_class()()

    def get_vnf_class(self):
        """Returns type of currently configured vnf implementation.

        :return: Type of IVnf implementation if available.
            None otherwise.
        """
        return self._vnf_loader.get_class()

    def get_vnfs(self):
        """Returns dictionary of all available vnfs.

        :return: Dictionary of vnfs.
            - key: name of the class which implements IVnf,
            - value: Type of vnf which implements IVnf.
        """
        return self._vnf_loader.get_classes()

    def get_vnfs_printable(self):
        """Returns all available vnfs in printable format.

        :return: String containing printable list of vnfs.
        """
        return self._vnf_loader.get_classes_printable()

    def get_pktfwd(self):
        """Returns instance of currently configured packet forwarder implementation.

        :return: IPktFwd implementation if available, None otherwise.
        """
        return self._pktfwd_loader.get_class()()

    def get_pktfwd_class(self):
        """Returns type of currently configured packet forwarder implementation.

        :return: Type of IPktFwd implementation if available.
            None otherwise.
        """
        return self._pktfwd_loader.get_class()

    def get_pktfwds(self):
        """Returns dictionary of all available packet forwarders.

        :return: Dictionary of packet forwarders.
            - key: name of the class which implements IPktFwd,
            - value: Type of packet forwarder which implements IPktFwd.
        """
        return self._pktfwd_loader.get_classes()

    def get_pktfwds_printable(self):
        """Returns all available packet forwarders in printable format.

        :return: String containing printable list of packet forwarders.
        """
        return self._pktfwd_loader.get_classes_printable()
Example #5
0
class Loader():
    """Loader class - main object context holder.
    """
    _swvalidator_loader = None

    def __init__(self):
        """Loader ctor - initialization method.

        All data is read from configuration each time Loader instance is
        created. It is up to creator to maintain object life cycle if this
        behavior is unwanted.
        """
        self._swpreurlsvalidator_loader = LoaderServant(
            settings.getValue('SW_PRE_URLS_VALID_DIR'),
            settings.getValue('SW_PRE_URLS_VALIDATOR'), ISwPreUrlsValidator)
        self._swpreconfigvalidator_loader = LoaderServant(
            settings.getValue('SW_PRE_CONFIG_VALID_DIR'),
            settings.getValue('SW_PRE_CONFIG_VALIDATOR'),
            ISwPreConfigValidator)
        self._swpoststatevalidator_loader = LoaderServant(
            settings.getValue('SW_POST_STATE_VALID_DIR'),
            settings.getValue('SW_POST_STATE_VALIDATOR'),
            ISwPostStateValidator)
        self._swpostsecurityvalidator_loader = LoaderServant(
            settings.getValue('SW_POST_SECURITY_VALID_DIR'),
            settings.getValue('SW_POST_SECURITY_VALIDATOR'),
            ISwPostSecurityValidator)
        self._nwlinksvalidator_loader = LoaderServant(
            settings.getValue('NW_LINKS_VALID_DIR'),
            settings.getValue('NW_LINKS_VALIDATOR'), INwLinksValidator)
        self._resmodvalidator_loader = LoaderServant(
            settings.getValue('RES_MOD_VALID_DIR'),
            settings.getValue('RES_MOD_VALIDATOR'), IResModValidator)

    def get_swpreurlsvalidator(self):
        """ Returns a new instance configured Software Validator
        :return: ISwPreUrlsValidator implementation if available, None otherwise
        """
        return self._swpreurlsvalidator_loader.get_class()()

    def get_swpreurlsvalidator_class(self):
        """Returns type of currently configured Software Validator.

        :return: Type of ISwPreUrlsValidator implementation if available.
            None otherwise.
        """
        return self._swpreurlsvalidator_loader.get_class()

    def get_swpreurlsvalidators(self):
        """
        Get Prevalidators
        """
        return self._swpreurlsvalidator_loader.get_classes()

    def get_swpreurlsvalidators_printable(self):
        """
        Get Prevalidators for printing
        """
        return self._swpreurlsvalidator_loader.get_classes_printable()

    def get_swpreconfigvalidator(self):
        """ Returns a new instance configured Software Validator
        :return: ISwPreConfigValidator implementation if available, None otherwise
        """
        return self._swpreconfigvalidator_loader.get_class()()

    def get_swpreconfigvalidator_class(self):
        """Returns type of currently configured Software Validator.

        :return: Type of ISwPreConfigValidator implementation if available.
            None otherwise.
        """
        return self._swpreconfigvalidator_loader.get_class()

    def get_swpreconfigvalidators(self):
        """
        Get Prevalidators
        """
        return self._swpreconfigvalidator_loader.get_classes()

    def get_swpreconfigvalidators_printable(self):
        """
        Get Prevalidators for printing
        """
        return self._swpreconfigvalidator_loader.get_classes_printable()

    def get_swpoststatevalidator(self):
        """ Returns a new instance configured Software Validator
        :return: ISwPostStateValidator implementation if available, None otherwise
        """
        return self._swpoststatevalidator_loader.get_class()()

    def get_swpoststatevalidator_class(self):
        """Returns type of currently configured Software Validator.

        :return: Type of ISwPostStateValidator implementation if available.
            None otherwise.
        """
        return self._swpoststatevalidator_loader.get_class()

    def get_swpoststatevalidators(self):
        """
        Get Postvalidators
        """
        return self._swpoststatevalidator_loader.get_classes()

    def get_swpoststatevalidators_printable(self):
        """
        Get Postvalidators for printing
        """
        return self._swpoststatevalidator_loader.get_classes_printable()

    def get_swpostsecurityvalidator(self):
        """ Returns a new instance configured Software Validator
        :return: ISwPostSecurityValidator implementation if available, None otherwise
        """
        return self._swpostsecurityvalidator_loader.get_class()()

    def get_swpostsecurityvalidator_class(self):
        """Returns type of currently configured Software Validator.

        :return: Type of ISwPostSecurityValidator implementation if available.
            None otherwise.
        """
        return self._swpostsecurityvalidator_loader.get_class()

    def get_swpostsecurityvalidators(self):
        """
        Get Postvalidators
        """
        return self._swpostsecurityvalidator_loader.get_classes()

    def get_swpostsecurityvalidators_printable(self):
        """
        Get Postvalidators for printing
        """
        return self._swpostsecurityvalidator_loader.get_classes_printable()

    def get_nwlinksvalidator(self):
        """ Returns a new instance configured Nw-Links Validator
        :return: INwLinksValidator implementation if available, None otherwise
        """
        return self._nwlinksvalidator_loader.get_class()()

    def get_nwlinksvalidator_class(self):
        """Returns type of currently configured Nw-Links Validator.

        :return: Type of NwLinksValidator implementation if available.
            None otherwise.
        """
        return self._nwlinksvalidator_loader.get_class()

    def get_nwlinksvalidators(self):
        """
        Get Linkvalidators
        """
        return self._nwlinksvalidator_loader.get_classes()

    def get_nwlinksvalidators_printable(self):
        """
        Get Linkvalidators for printing
        """
        return self._nwlinksvalidator_loader.get_classes_printable()

    def get_resmodvalidator(self):
        """ Returns a new instance configured Nw-Links Validator
        :return: IResModValidator implementation if available, None otherwise
        """
        return self._resmodvalidator_loader.get_class()()

    def get_resmodvalidator_class(self):
        """Returns type of currently configured Nw-Links Validator.

        :return: Type of ResModValidator implementation if available.
            None otherwise.
        """
        return self._resmodvalidator_loader.get_class()

    def get_resmodvalidators(self):
        """
        Get ResoureModelValidators
        """
        return self._resmodvalidator_loader.get_classes()

    def get_resmodvalidators_printable(self):
        """
        Get ResoureModelValidators for printing
        """
        return self._resmodvalidator_loader.get_classes_printable()